Jump to content

IE Have different upload image types?


scrubbicus

Recommended Posts

I'm trying to make an upload form for only image files and internet explorer isn't deteching the extension correctly. Does IE have different extension names?

 

My code is like this

 

$ext = 'jpg png bmp jpeg gif';
foreach($_FILES['pic']['tmp_name'] as $k=>$tmpfile)
{
$type = $_FILES['pic']['type'][$k];
if(!strstr($type,$ext)) $err++;
}

 

 

The upload works fine on FireFox, OPera, and Safari but Internet Explorer is giving by an error.

Link to comment
https://forums.phpfreaks.com/topic/165570-ie-have-different-upload-image-types/
Share on other sites

Why not? cause then if they upload an exe it will search that string for exe and it won't find it so it'll give the the $err and later down the road the upload won't happen.

 

Well the error was created by me. It says the Your uploaded images are the wrong type of file which was generated when a loop scanned through each file, grabbed the extension looked for the extension in my string of valid ones and couldn't find it. So I'm thinking a .JPEG is something else on IE?

Why not? cause then if they upload an exe it will search that string for exe and it won't find it so it'll give the the $err and later down the road the upload won't happen.

 

I could easily upload jpg.exe and it will get through. The best way to check to see if a file is an image is to use get_image_size, this will return false if the file isn't an image, regardless of what file extension your using. Remember, file extensions mean nothing on Linux.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.