我有下面的代碼通過HTML格式的FTP上傳文件。ftp_delete不起作用 - >「1不是一個有效的FTP緩衝區資源...」
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
// $ftp_server = "xxx";
$ftp_server = 'xxx';
$ftp_username = "xxx";
$ftp_password = "xxx";
//setup of connection
$conn_id = ftp_connect($ftp_server) or die("could not connect to $ftp_server");
//login
if(ftp_login($conn_id, $ftp_username, $ftp_password))
{
echo "conectd as [email protected]$ftp_server\n";
}
else {
echo "could not connect as $ftp_username\n";
}
$file = $_FILES["uploadedfile"]["name"];
$remote_file_path = "/import/".$file;
ftp_put($conn_id, $remote_file_path, $_FILES["uploadedfile"]["tmp_name"], FTP_ASCII);
ftp_close($conn_id);
echo "\n\nconnection closed";
include("writedb.php");
if (ftp_delete($conn_id, $file)) {
echo "$file deltet successful.\n";
} else {
echo "cant delete: $file\n";
}
?>
除了刪除上傳的文件,Everythings的作品。
的錯誤是這樣的:
Warning: ftp_delete(): 1 is not a valid FTP Buffer resource in (correct path) on line 29
cant delete: daten.csv
什麼是錯在我的代碼?
謝謝各位:)
您正在嘗試關閉後刪除。 –