quick file upload question

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
the_lar
Forum Newbie
Posts: 4
Joined: Mon Aug 21, 2006 9:55 am

quick file upload question

Post by the_lar »

Hi,

I'm using a form to upload images that are used in a PDF. I'm allowing GIF's and JPEGS. I'm detecting the file type via: $_FILES['userfile']['type'] - GIF's are fine and work when I upload 72 dpi or 300 dpi, however jpegs are only detected when they are 72 dpi???? Weird! The server is a Win2K with PHP 4.3 and apache 2.

Any help would be fab

Many thanks
Kevin
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I wouldn't suggest using the type field. It's supplied by the user-agent and is easily faked. getimagesize() may be of interest. The version of PHP you're using may have issues interrogating some badly written jpeg files however, so you may need to upgrade PHP or GD depending on your compatibility and flexibility.
Post Reply