Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ftp_delete() function in PHP
The ftp_delete() function is used to delete a file on the FTP server.
Syntax
ftp_delete(con,myfile);
Parameters
con − The FTP connection
myfile − The file to be deleted
Return
The ftp_delete() function returns TRUE on success or FALSE on failure
Example
The following is an example to delete a file −
<?php
$ftp_server="192.168.0.4";
$ftp_user="amit";
$ftp_pass="tywg61gh";
$con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$myfile = "E:/new/demo.txt";
if (ftp_delete($con, $myfile)) {
echo "The file deleted!";
} else {
echo "The file cannot be deleted!";
}
ftp_close($con);
?>Advertisements