Home > Backend Development > PHP Tutorial > php ftp_delete and ftp_size tutorial_PHP tutorial

php ftp_delete and ftp_size tutorial_PHP tutorial

WBOY
Release: 2016-07-13 17:06:56
Original
1022 people have browsed it

This article will talk about php ftp_delete to delete files and ftp_size to obtain the file size. Let’s take a look at examples of the two functions respectively.

This article will talk about php ftp_delete deleting files and ftp_size getting the file size. Let’s take a look at examples of the two functions respectively.

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

$file = 'somefile.txt';
// Connect to FTP server
$conn_id = ftp_connect($ftp_server);
//Verify username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
//Get the size of the specified file www.111cn.cn
$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);
?>

If you reprint, please indicate that it comes from www.111cn.cn

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630482.htmlTechArticleThis article talks about php ftp_delete to delete files and ftp_size to get the file size. Let’s take a look at the two separately. An instance of the function. This article will talk about php ftp_delete to delete files...
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