Delete a file not working...

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
rr299
Forum Newbie
Posts: 8
Joined: Sat Apr 19, 2008 4:22 pm

Delete a file not working...

Post by rr299 »

I am new to php and just can't figure out this problem. I have some code which uploads a series of jpegs to a directory eg uk/image.jpg. That is working fine. I now want to delete the image.jpg with some code.


Here is the bit of code:

$thumb_del = "uk/image.jpg";
unlink ($image_del);

It isn't working. My error says [26-Apr-2008 22:28:47] PHP Warning: unlink(uk/12.jpg) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in C:\where-my-files-are\delete_image.php on line 40

I don't understand as it does exist! Any ideas?
Thanks
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Delete a file not working...

Post by aceconcepts »

Are you running a virtual server?

Because you using different slashes!
rr299
Forum Newbie
Posts: 8
Joined: Sat Apr 19, 2008 4:22 pm

Re: Delete a file not working...

Post by rr299 »

Oh i sorted it, there was an error with my variable!
Post Reply