PHP: Check if a file exists on a server

doeghosahroy

New Member
Hey; I'm currently using the following way of checking whether an image exists on a server:\[code\]if (@getimagesize($s3url)) { //do stuff }\[/code\]Needless to say, that's hardly the most elegant way of doing that... But honestly, I don't actually know where to start looking for a better solution. I was wondering if perhaps it was possible to just send a request, receive a HTTP response (i.e. if the HTTP response is 200, carry on, if not, evaluate to false); but is that the best way?What is the best function to check for the existence of an (image) file?
 
Back
Top