PHP+FTP文件上传下载改名删除复制移动等

$os_str ($os_name)"; //正常

echo "

列表:列出指定文件夹文件

"; //正常 $files = ftp_nlist($conn_id, "."); //ftp_rawlist foreach ($files as $file) { echo "

$file

"; } echo "

上传 $file1->$file2

"; //正常 if (ftp_put($conn_id, $file2, $file1, FTP_ASCII)) { echo "上传成功($file1->$file2)"; } else { echo "上传失败"; } echo "

下载 $file2->$file3

"; //正常 if (ftp_get($conn_id, $file3, $file2, FTP_ASCII)) { echo "下载成功($file2->$file3)"; } else { echo "下载失败"; } echo "

改名 $file2->$file3

"; if (ftp_rename($conn_id, $file2, $file3)) { echo "更名成功($file2->$file3)"; } else { echo "更名失败"; } echo "

创建目录 $fold1

"; if (ftp_mkdir($conn_id, $fold1)) { echo "创建目录成功($fold1)"; } else { echo "创建目录失败"; } echo "

创建目录 $fold2

"; if (ftp_mkdir($conn_id, $fold2)) { echo "创建目录成功($fold2)"; } else { echo "创建目录失败"; } echo "

复制 $file3->$fold1/$file3

"; if (ftp_put($conn_id, "$fold1/$file3", $file3, FTP_ASCII)) { echo "复制成功($file3->$fold1/$file3)"; } else { echo "复制失败"; } echo "

删除 $fold1/$file3

"; if (ftp_delete($conn_id, "$fold1/$file3")) { echo "删除成功($fold1/$file3)"; } else { echo "删除失败"; } echo "

移动 $file3->$fold2/$file3

"; if (ftp_rename($conn_id, $file3, "$fold1/$file3")) { echo "移动成功($file3->$fold1/$file3)"; } else { echo "移动失败"; } // 关闭连接 ftp_close($conn_id);

你可能感兴趣的:(php)