Close Panel
Hello Guest! | Log In


lheader.gif rheader.gif
tgcontentlogo.gif
tgcontentlogob.gif

PHP: Delete File If Exists

I ran across this function to delete a file from the server if it exists some time ago. It has been very useful to me.

<?php
$DelFilePath = "/home/path/to/file";
if (file_exists($DelFilePath))  {
unlink($DelFilePath);
}
?>

One Comment

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

lhfooter.gif
Valid XHTML 1.0 | Valid CSS | Load Time: 0.606870 sec(s)
rfooter.gif

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /home/tg007net/public_html/blog/wp-includes/script-loader.php on line 607