Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

php upload problem (IE compatibility)


ghost's Avatar
0 0

i did a image upload website http://zokio.zapto.org:8080/site/imagehosting/, the upload script work fine with firefox, but when people try to upload a .jpg file, it says: wrong file type… but when they try with Firefox, it work fine, so can someone help me for my probleme? heres is a part of my script, if it can help!

array('image/gif',
'image/bmp',
'image/jpeg',
'application/x-shockwave-flash',
'application/zip',
'application/x-zip',
'application/x-zip-compressed',
'application/octet-stream',
'application/x-compress',
'application/x-compressed',
'multipart/x-zip',
'image/photoshop',
'image/x-photoshop',
'image/psd',
'application/photoshop',
'application/psd',
'zz-application/zz-winassoc-psd',
'application/tga',
'application/x-tga',
'application/x-targa',
'image/tga',
'image/x-tga',
'image/targa',
'image/x-targa',
'image/png',
'image/tif',
'image/x-tif',
'image/tiff',
'image/x-tiff',
'application/tif',
'application/x-tif',
'application/tiff',
'application/x-tiff',
'image/ico', 
'image/x-icon',
'application/ico',
'application/x-ico',
'application/x-win-bitmap',
'image/x-win-bitmap',
'application/octet-stream',
'text/plain',
'application/txt',
'browser/internal',
'text/anytext',
'widetext/plain',
'image/jpg',
'widetext/paragraph' );```



ghost's Avatar
0 0

someone?


Mr_Cheese's Avatar
0 1

i cant see why it would fuxor in IE and not firefox, because my guess would be all data would be sent the same regardless of IE or firefox.

perhaps one browser doesnt have JS enabled or something?

not really too sure.


ghost's Avatar
0 0

theres no javascript on my site so im pretty sure that isnt the problem but damn, this is pretty frustrating!


ghost's Avatar
0 0

It couldn't be the browser because all server-side scripts are ran on the server. So, I don't know the problem.


ghost's Avatar
0 0

Actually, it is the browser that sends the content type.

While firefox sends it as "image/jpeg" for a jpg file, I.E. sends it as "image/pjpeg". So just add "image/pjpeg" to the array and it should work fine. :)


ghost's Avatar
0 0

Jake knows ALL!


ghost's Avatar
0 0

hmm…I wonder if there would be a way to spoof this? I mean if the browser sends it, you might be able to upload a different filetype and make the browser say it's image/jpeg or whatever. then maybe you could put, say, php files on an image hosting site. just a thought. does anybody know if it could work?


ghost's Avatar
0 0

Good observation. You are right, it could be spoofed.

Just send the headers as:

Content-Type: image/jpeg

file contents here```