PHP –– deleting a file
written by: admin
Date Written: 11/18/07
Last Updated: 8/9/19
This code is used to delete a flat file (any ol' file on your server). The address of the $file is relative, so
../ to go up a folder and
../foldername/file.txt to go up a file and then into a folder to delete it and
foldername/file.txt to go into a folder that is in the folder you are currently in to delete it.
<?php
unlink('me.txt');
?>
I made a file with the above as the only code and it deleted the me.txt file that was located in the same folder as itself.
related material:
PHP –– View Source
dd forums thread here is a thread where I had an undelete–able image file.
Here is my conversation with GoDaddy on 8/12/07 in an effort to get a file deleted.
"Sure thing. Should be easy." seconds later.
"huh, that was unexpected. Let me get my supervisor."
A few seconds later his supervisor comes online and after hearing the problem replies to the GoDaddy representative: "sure. All you have to do is..." a few seconds later I hear "huh, that's interesting. Let me redirect you to my supervisor who specializes in these things."
A minute later another voice comes online and I explain my situation. He replies without any bravado "sure, just a sec." A few seconds later: "huh, that's interesting. I'm going to need to refer this to R&D. They will get back to you in a few days."
ref TAGS: php,
flatfile