Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
03-01-2008, 11:52 AM #1
- Join Date
- Dec 2006
- Thanked 1 Time in 1 Post
checking that a URL points to an image
how would I protect myself from an attack to ensure that a user submitted URL points to an image (either .jpg, .jpeg, .gif, .png or .ico )?
the var is of this type:
$imageURL = 'http://www.foo.com/img/myimages/dog.gif'
$imageURL = 'http://www.bar.com/images/home/vacation/beach.jpg'
$imageURL = 'http://www.foobarb.com/img/myimages/banner.png'
I dont want people submitting .exe files for instance
03-01-2008, 06:30 PM #2
- Join Date
- Dec 2005
- Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
- Thanked 637 Times in 625 Posts
You can use the function getimagesize(), but the note in the manual on using that function on remote files is:
I haven't messed with streams much, but here's the page in the manual that introduces the concept.This parameter specifies the file you wish to retrieve information about. It can reference a local file or (configuration permitting) a remote file using one of the supported streams.