PHP Delete file

(1 votes, average: 5.00 out of 5)
 Loading ...

Delete a file in the file system. Note that this file system we’re talking about is the server’s file system. PHP nor other web-based programming language deletes a file system on the client’s side.

function deleteFile($filename) {
  $do = unlink($filename);

  if ($do=="1") {
    echo "The file was deleted successfully.";
  } else {
    echo "There was an error trying to delete the file.";
  }
}

Bookmark and Share

Found this post useful? Buy me a cup of coffee or help support the sponsors on the right.

Related Posts with Thumbnails

tags:

Leave a Reply