PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am using a checkbox form to delete profile images but I can't seem to get the php code to remove the physical file from my server. The records are removed from my SQL table but I can't the actual image files to delete. Here is my code:
Thanks for the reply Christopher. I have attempted many syntax changes without success. Here is the the part that I don't understand, I can write the physical file to the disk, I can create and delete the "link" record from SQL, but I can't seem to unlink the file from the server. I think what is happening is the array that I create in my "form" is not being properly posted to my processor file. I may be way off base here, and it wouldn't be the first time, but I can't seem to use the same variables to display AND function. I'm very new to php, by the way.
Thanks,
Clark
The header() function has to be the first instruction in the file, if you're going to use it, otherwise it won't work. Besides, everything works properly except the unlink() function. The SQL record is removed but the physical file on the server remains. I want to unlink() the file when I am deleting the record from my table.
header() doesn't have to be the first thing in a file, but has to be the first output to work.
still, you shouldn't redirect until the work is done - you can catch stuff that way and know what is happening
remove ."" from the end of your file name