[請益] 上傳FTP很常失敗
我用下面的Function來上傳FTP
不過通常3次只有1次成功
有時後會連續失敗好幾次
想請問大大們 怎麼提高FTP上傳的成功率.
function uploadFTP( $Des, $Filename){
$FTP_HOST ="00.000.000.00";
$FTP_USER ="abc123";
$FTP_PW ="abc123";
$FTP_ROOT_DIR="/";
// 目的資料夾
$FTP_DIR = $Des;
// 來源檔案
$file = $Filename;
$fp = fopen($file, 'r');
// set up basic connection
$conn_id = ftp_connect($FTP_HOST);
// login with username and password
$login_result = ftp_login($conn_id, $FTP_USER, $FTP_PW);
ftp_chdir($conn_id,$FTP_DIR);
// try to upload $file
if (ftp_fput($conn_id, $file, $fp, FTP_ASCII)) {
echo "Successfully uploaded $Des$file\n";
} else {
echo "There was a problem while uploading $Des$file\n";
}
echo "<br>";
// close the connection and the file handler
ftp_close($conn_id);
fclose($fp);
}
--
玩運彩 - 運動彩券朋友圈
http://www.playsport.com.tw
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.47.216.226
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章