image upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

image upload

Post by amir »

Trying to upload images.
So how can I be sure its an image 100% and how I can allow only jpg, jpeg images ?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

you could use something like getimagesize()
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Check the file signature if GD isn't availble...

Most files (not sure about JPEG, but GIF, BMP) use a fixed file header at the start of the file which basically tells the rendering engine, etc everything it needs to know to fire up the file.

http://www.wotsit.org
Post Reply