PHP ftp_delete() Function

Definition and Usage

The ftp_delete() function deletes a file from an FTP server.

If successful, returns true, otherwise returns false.

Syntax

ftp_delete(ftp_connection,path)
Parameters Description
ftp_connection Required. Specifies the FTP connection to be used (the identifier of the FTP connection).
path Required. Specifies the path of the file to be deleted.

Description

The ftp_delete() function is used to delete a file from an FTP server by parameter path the specified file.

Example

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
echo ftp_delete($conn,"test.txt");
ftp_close($conn);
?>

Output:

1