PHP to the operation of the FTP summary is as follows, detailed see the official documents
$ftp _conn=Ftp_connect("192.168.1.230") or die(' host error ');//Link FTP serverFtp_login($ftp _conn, "Lihailong", "123456") or die("Login Error");//log in to FTPFtp_chdir($ftp _conn, '/abc ');//Enter the FTP ABC directoryEcho' <pre> ';Print_r(ftp_rawlist($ftp _conn,"."));//detailed list of directories and files in the current directoryEcho' </pre> ';Print_r(ftp_nlist($ftp _conn,"."));//list files in the current directory@Ftp_delete($ftp _conn, ' 123.txt ');//Delete file//download a file from FTP save to local//$localfile = fopen (' Abc.txt ', "w");//open Local file//$sourcefile = "Abc.txt";//ftp File//Ftp_fget ($ftp _conn, $localfile, $sourcefile, FTP_ASCII),//Fclose ($localfile);//close Local file//upload a file locally to the FTP directory//$localfile = fopen (' Abc.txt ', ' r ');//open Local file//$target = ' abc.txt ';//Specify FTP File//ftp_fput ($ftp _conn, $target, $localfile, ftp_ascii);// Local file copied to FTP File//fclose ($localfile);//close Local file//download file from FTP to localFtp_get($ftp _conn, "Ceshi.mp4", "Ceshi.mp4", ftp_ascii);//simultaneous download//ftp_nb_get ($ftp _conn, "Ceshi.mp4", "Ceshi.mp4", ftp_ascii);//asynchronous download, that is, when downloading the same time can do other operations//from the local upload to the FTPFtp_put($ftp _conn, "Ceshi.mp4", "Ceshi.mp4", ftp_ascii);//sync upload//ftp_nb_put ($ftp _conn, "Ceshi.mp4", "Ceshi.mp4", ftp_ascii);//asynchronous upload, that is, when uploading the same time can do other operations//new directory on the FTP server @Ftp_mkdir($ftp _conn, "TestDir");Ftp_close($ftp _conn);//Close FTP
PHP common operations and methods for handling FTP