Skip to content

Instantly share code, notes, and snippets.

@kimisme9386
Last active August 29, 2015 14:16
Show Gist options
  • Save kimisme9386/7e0dc56b7e4cf9e9ba7c to your computer and use it in GitHub Desktop.
Save kimisme9386/7e0dc56b7e4cf9e9ba7c to your computer and use it in GitHub Desktop.
php ftp send
<?php
$ftpHost = ''; //ftp主機名稱
$ftpId = ''; //ftp帳號
$ftpPwd = ''; //ftp密碼
$remote_file = preg_replace('/\?|:|\/|\\\|\*|"|\||<|>/', '', $remote_file);
//$remote_file = iconv('UTF-8','BIG5',$remote_file);
$remote_file = iconv('UTF-8','gb2312',$remote_file);
$ftpDir = '';
$remote_send_file = $ftpDir.trim($remote_file); //傳到遠端的檔名
$local_file = ''; //本地檔
$conn_id = ftp_connect($ftpHost);
$login_result = ftp_login($conn_id, $ftpId, $ftpPwd);
$ftpok = ftp_put($conn_id, $remote_send_file, $local_file, FTP_BINARY);
ftp_close($conn_id);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment