Jump to content


Photo

unlink not workin error message


  • Please log in to reply
4 replies to this topic

#1 stefpretty

stefpretty
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 07 April 2006 - 02:22 AM

[!--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:
   unlink('photo/'.$_SESSION['photo']);

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.t1hostin...a/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

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

also my permissions are fine

#2 stefpretty

stefpretty
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 07 April 2006 - 11:25 AM

anyone??? :(

#3 bradcis

bradcis
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 07 April 2006 - 12:15 PM

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.

#4 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 07 April 2006 - 12:32 PM

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.";
}

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.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#5 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 07 April 2006 - 02:22 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users