Welcome Guest, Not a member yet? Register   Sign In
How to check if file exists via URL
#4

[eluser]codex[/eluser]
[quote author="Pygon" date="1193857196"]
Code:
if( fopen('$file','r') )
{
//exists
}

This would cover a simple version or whether you get a response on the URL.

The reason that many of these functions seem "heavy", I would assume, is because they attempt to determine whether the file is real or simply a custom 404 error page (most likely via socket >> request >> mime type comparison).[/quote]

Well, I actually had tried this, but it doesn't validate the mimetype. It returns a true, but this is not what I'm looking for. I'm looking for 'are you a valid imagefile?'


Messages In This Thread
How to check if file exists via URL - by El Forum - 10-30-2007, 09:45 PM
How to check if file exists via URL - by El Forum - 10-31-2007, 06:19 AM
How to check if file exists via URL - by El Forum - 10-31-2007, 07:59 AM
How to check if file exists via URL - by El Forum - 10-31-2007, 08:06 AM
How to check if file exists via URL - by El Forum - 10-31-2007, 08:11 AM
How to check if file exists via URL - by El Forum - 10-31-2007, 08:19 AM
How to check if file exists via URL - by El Forum - 10-31-2007, 02:01 PM
How to check if file exists via URL - by El Forum - 06-21-2010, 01:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB