DISQUS

Tech-Recipes: PHP: Delete or unlink a file on the server | PHP programming | Tech-Recipes

  • wiz432 · 10 months ago
    a nice n short article on how to delete a file using PHP codes. Good work. Thank you for sharing.
  • Christopher · 6 months ago
    Sometimes it's a good idea to check if the file exists first, then you won't get a PHP error if the file you're trying to delete is not there. Just add a simple IF statement to accomplish this:

    $tmpfile = "/full/path/to/delete-me.txt";
    if (file_exists($tmpfile)) { unlink ($tmpfile); }
  • Nitish · 5 months ago
    hmmm.... good post...