Recover deleted files from Recycle Bin software. Connect to FTP under PHP to upload, download and delete files. Example code

WBOY
Release: 2016-07-29 08:42:53
Original
1635 people have browsed it

php ftp transfer files to the server

Copy the code The code is as follows:


// Start
$ret = ftp_nb_get ($my_connection, "test", "README", FTP_BINARY,
filesize( "test"));
// Or: $ret = ftp_nb_get ($my_connection, "test", "README",
// FTP_BINARY, FTP_AUTORESUME);
while ($ret == FTP_MOREDATA) {
// can be inserted Other codes
echo ".";
// Continue to send...
$ret = ftp_nb_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
echo "Download error...";
exit (1);
}
?>


php ftp delete file

Copy code The code is as follows:


$file = 'public_html/old.txt';
// Connect to FTP server
$conn_id = ftp_connect('www.jb51.net');
// Verify username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// Delete specified file
if ( ftp_delete($conn_id, $file)) {
echo "$file file deleted successfully";
} else {
echo "$file file deleted failed";
}
// Close FTP connection
ftp_close($conn_id) ;
?>


php ftp download file

Copy code The code is as follows:


$file = 'somefile.txt';
// Connect to FTP server
$conn_id = ftp_connect($ftp_server);
//Verify username and password www.jb51 .net
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
//Get the size of the specified file
$res = ftp_size($conn_id , $file);
if ($res != -1) {
echo "$file file size is $res bytes";
} else {
echo "Failed to obtain remote file size";
}
//Close FTP connection
ftp_close($conn_id);
?>

The above introduces the example code of the software to recover files deleted from the Recycle Bin by connecting to FTP under PHP to upload, download and delete files, including the content of the software to recover files deleted from the Recycle Bin. I hope it will be helpful to friends who are interested in PHP tutorials.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template