[請益] 上傳FTP很常失敗

看板PHP作者 (阿達)時間16年前 (2009/06/01 09:05), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
我用下面的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
文章代碼(AID): #1A8ob3g7 (PHP)
討論串 (同標題文章)
文章代碼(AID): #1A8ob3g7 (PHP)