Last active
August 29, 2015 14:16
-
-
Save kimisme9386/7e0dc56b7e4cf9e9ba7c to your computer and use it in GitHub Desktop.
php ftp send
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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