Jump to content

Archived

This topic is now archived and is closed to further replies.

stefpretty

unlink not workin error message

Recommended Posts

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Warning: unlink(photo/15.jpg): No such file or directory in /home/fsuk/public_html/bla/delphoto.php on line 9[/quote] thts the error message am i using the ulin incorrectly? heres the coe of line 9:
[code]   unlink('photo/'.$_SESSION['photo']);[/code]

it also does it when uploading with the upload form as befor eit uploads it deletes the old pic frst so im thinkin its my syntax of unlink..... heres error message [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Warning: unlink(http://fsuk.t1hosting.co.uk/bla/photos/15.jpg): No such file or directory in /home/fsuk/public_html/bla/changephotoparse.php on line 28[/quote] and code of line 28

[code]unlink('http://fsuk.t1hosting.co.uk/bla/photos/'.$_SESSION['photo']);[/code]
thanks please get back to me asap

also my permissions are fine

Share this post


Link to post
Share on other sites
Are you sure you actually have file '15.jpg' in the photo directory (/home/fsuk/public_html/bla/photo/15.jpg)? This could be causing the error.

Share this post


Link to post
Share on other sites
[code]if (file_exists('photo/'.$_SESSION['photo'])) {
   unlink('photo/'.$_SESSION['photo']) or die("Unlink problem!");
  echo "File removed successfully.";
} else {
  echo "Someone beat me to it.  The file does not exist.";
}[/code]

This might help. Also you can't unlink a file on a remote server. You must use relative paths, so no unlink('http://myserver.com/filename').

Check Appendix M on the [a href=\"http://www.php.net\" target=\"_blank\"]http://www.php.net[/a] site for more information.

Let us know if you have any further problems.

Share this post


Link to post
Share on other sites
You have "/photos" as the directory in one line and "/photo" in the other. Which directory are you're photos stored in? Resolve this and your problem may go away.

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.