// 上傳 if (ftp_put($conn_id, $remote_file, $local_file, FTP_ASCII)) { echo"Successfully uploaded $local_file\n"; } else { echo"There was a problem while uploading $local_file\n"; }
// 下載 if (ftp_get($conn_id, $local_file, $remote_file, FTP_ASCII)) { echo"Successfully downloaded $remote_file\n"; } else { echo"There was a problem while downloading $remote_file\n"; }
// 刪除 if (ftp_delete($conn_id, $remote_file)) { echo"Successfully deleted $remote_file\n"; } else { echo"There was a problem while deleting $remote_file\n"; }
FTP 建立目錄
1 2 3 4 5 6 7 8
$dir = 'test'; // 目錄名稱
// 建立目錄 if (ftp_mkdir($conn_id, $dir)) { echo"Successfully created $dir\n"; } else { echo"There was a problem while creating $dir\n"; }
FTP 刪除目錄
1 2 3 4 5 6 7 8
$dir = 'test'; // 目錄名稱
// 刪除目錄 if (ftp_rmdir($conn_id, $dir)) { echo"Successfully deleted $dir\n"; } else { echo"There was a problem while deleting $dir\n"; }