0
上失敗我有一個工作代碼,上傳圖片,它工作正常,我的臨時服務器,但部署到住的時候,給出了「無法通過FTP傳輸」,請檢查代碼FTP不同的服務器
if (move_uploaded_file($_FILES['tempImage']['tmp_name'], $upload_to_temp)) {
$ftp_path = "employeeimages/" . $filename;
$ftphost = FTPDOMAIN;
$ftpusr = FTPUSER;
$ftppwd = FTPPASSWORD;
if (file_exists($upload_to_temp)) {
$conn_id = ftp_connect($ftphost) or die("Couldn't connect to $ftphost");
$login_result = ftp_login($conn_id, $ftpusr, $ftppwd);
if (ftp_put($conn_id, $ftp_path, $upload_to_temp, FTP_BINARY)) {
unlink($upload_to_temp);
$image_up = $ftp_path;
mysql_query("UPDATE employees SET image = '".$ftp_path."' WHERE id = '".$newid."'");
// $_SESSION['emp_image'] = $ftp_path;
}else{
echo "Error transferring file via ftp!<br/>";
echo $filename . "<br/>";
echo $upload_to_temp . "<br/>";
echo $ftp_path . "<br/>";
}
}else{
echo "File does not exist in img/temp!";
}
}else{
echo "Error moving file to temp location!<br>";
}
你能猜出來嗎?
感謝
我甚至在代碼中看不到字符串「無法通過FTP傳輸」。這是從哪裏來的? – Mike
對不起,這是錯誤通過ftp傳輸文件 –
'var_dump($ login_result);'display? – Mike