Unlink() error

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!

Moderator: General Moderators

Post Reply
Hendeca
Forum Commoner
Posts: 29
Joined: Tue Nov 18, 2008 1:27 pm

Unlink() error

Post by Hendeca »

Hello!

I posted here a while ago regarding a problem with the unlink() function. I've been trying to fix it for weeks and can't seem to do it! I've been working with the code, and I've been trying to simply delete a photo based on a filename from a database. Instead of going into the code right now, I'm mainly just concerned with one thing:

What does the following error mean:

Warning: unlink(/home/owstopit/lizziewrightphotography.com/css/images/photos/wallsanddoors/) [function.unlink]: Is a directory in /home/owstopit/lizziewrightphotography.com/private/delete_photo_wallsanddoors.php on line 14

The first filepath mentioned in the error is the path to the folder containing the image I want to delete. The second path is the location of the script that's trying to delete the file. What does this error mean?!
User avatar
ironmaan
Forum Newbie
Posts: 2
Joined: Tue Dec 16, 2008 10:57 am
Location: Las Vegas, NV

Re: Unlink() error

Post by ironmaan »

A suggestion in another forum pointed to the variable for the filename from the database being empty.

http://forum.ragezone.com/f144/php-func ... nk-425744/
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Unlink() error

Post by John Cartwright »

Indeed, you are passing a directory path instead of the filename.. indicative of you misusing your variables. It will obviously complain if you are trying to delete a directory with files in it.

Try posting the relevant code, and try adding some debugging to figure out where your filename assignment (the file you want to delete) is not assigned correctly.
Post Reply