Page 1 of 1
Uploading .GIF images from MS Paint
Posted: Tue Oct 05, 2004 4:27 pm
by dashifen
Anyone ever have a problem with uploading .GIFs from MS Paint? I'm working on a site allowing JPEG and GIF uploads and I found out the MS Paint's JPEG images are of MIME type image/pjpeg and not image/jpeg. So I thought to check their .GIF format as well. However, when I try to upload the .GIF file from MS Paint with IE, I get a page cannot be displayed error. Try uploading the same .GIF with FireFox and had no problems. Anyone else ever encounter this? I was able to reproduce the error with different .GIFs and multiple times so it seems systemic and not a fluke.
David Goldfeder
Web and Database Specialist
University of Illinois, Urbana-Champaign
Department of Mechanical and Industrial Engineering
Posted: Tue Oct 05, 2004 4:32 pm
by feyd
image/pjpeg is a creation most often from IE, not because of the file data.
As for gifs in IE, I have no issues... maybe you have something funky in your code?
Posted: Wed Oct 06, 2004 2:41 am
by twigletmac
If you are allowing jpegs you do need to allow both image/pjpeg and image/jpeg as as feyd said this isn't a MS Paint thing but an MS thing. Did you check what filetype the GIFs where being shown as when you tried to upload them?
Mac
Posted: Wed Oct 06, 2004 2:02 pm
by dashifen
If it's a GIF from adobe photoshop or macromedia fireworks it works fine and shows as type image/gif. If it's a GIF from MS Paint, I can't even get the page to parse -- says it cannot be displayed -- so I don't know what type it is.
Posted: Wed Oct 06, 2004 2:20 pm
by feyd
since I don't have MSPaint on my system, can you post this file somewhere so I can look at it? Also, could you post your form/upload script(s), so I can test it against your functionality?
Posted: Wed Oct 06, 2004 2:38 pm
by twigletmac
If you disperse of the file upload stuff, put the file on your server and use something like [php_man]mime_content_type[/php_man]() on it what does it report?
Mac
Posted: Wed Oct 06, 2004 6:26 pm
by zenabi
This is a little off topic, but one of the comments in the PHP documentation says:
Don't rely on mime types (in upload scripts for example), they are very easy to fake.
File extensions are even easier to fake, so what is the best way to check that a file is exactly what you expect it to be?
Posted: Wed Oct 06, 2004 6:31 pm
by feyd
knowing the binary/character text pattern the file format(s) follow.
Here's a thread I was involved in about detecting file type:
viewtopic.php?t=23517