Page 1 of 1

Delete a file not working...

Posted: Sat Apr 26, 2008 4:35 pm
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

Re: Delete a file not working...

Posted: Sat Apr 26, 2008 4:56 pm
by aceconcepts
Are you running a virtual server?

Because you using different slashes!

Re: Delete a file not working...

Posted: Sat Apr 26, 2008 5:26 pm
by rr299
Oh i sorted it, there was an error with my variable!