Re: Does remote file(image) exist ?

From: Date: Sat, 18 Jan 2003 16:49:14 +0000
Subject: Re: Does remote file(image) exist ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-132107@lists.php.net to get a copy of this message
If you looked at the usercomments for file_exists you would see it saying to look at the fopen page for a example.... In the usercomments for fopen there is a post saying this: jamie.watt at murchison.com.au 03-Feb-2000 01:39 To check if a file exists using http or ftp use the following: <pre> $fp = @fopen("http://www.someurl.com/testfile.php3","r"); if ($fp) { print"The file exists!"; } else { print"The file does not exist"; } </pre> Note: The "@" in front of fopen suppresses the error output of the function. I hope this clears up some confusion. There is your answer :) ----- Original Message ----- From: "Stephen of Blank Canvas" <stephen@blankcanvas.info> To: <php-general@lists.php.net> Sent: Saturday, January 18, 2003 4:42 PM Subject: [PHP] Does remote file(image) exist ? > Hi Everyone, > > Sorry I have no example code at all for this at all, I know some people > don't like that but I just do not know where to start so am asking for > help. > > I have a system there users can put a picture of themselves by method of > URL in a MySQL field, however many of this image URL's do not work as > users type them in wrong. So what I wanted to do was find a way to test > to see if the image can be accessed, then if not display a default > image. > > Hope that makes sense, anyone already done something like this and want > to share code :-) > > Stephen >

« previous php.general (#132107) next »