July 15th, 2013, 09:46 PM
I have a problem deleting a .pdf file from the server. I get the name of the file that I want to delete from my DB and the file does exist but unlink just isn't working.
This is my code:
Now get the strange thing. If I refresh the site multiple times then the file will be deleted. Sometimes on the 4. refresh or 5....
$oldFileName = "../folder/".$_POST['oldName'];
Thanks for all the help!
July 16th, 2013, 01:13 AM
Are you determining whether or not the file was deleted based on whether the text 'Deleted' was printed or based on some external check?
Is file_exists returning false or is unlink returning false?
Do you have error reporting fully turned on?
Also your code allows an attacker to delete arbitrary files from your server.