Padgoi Posted June 30, 2007 Share Posted June 30, 2007 So I have a small script and it works fine in other browsers, but the people who use IE are having problems. They keep getting an error, "You tried to upload wrong file." Not sure why it's happening. Here's the PHP part of the script: if($_FILES['imgfile1']['name'] != '') { $img_arr = array('','image/jpeg', 'image/gif', 'image/jpg', 'image/GIF', 'image/JPEG', 'image/JPG'); if(array_search($_FILES['imgfile1']['type'], $img_arr)) { $target_path = "userimages/"; $target_path = $target_path . basename($_FILES['imgfile1']['name']); if(move_uploaded_file($_FILES['imgfile1']['tmp_name'], $target_path)) { $imgfile1 = basename( $_FILES['imgfile1']['name']); $image1 = $imgfile1; } else { header("Location:signup.php?log=Image uploading failed, select image to upload"); exit; } } else { header("Location:signup.php?log=You tried to upload wrong file"); exit; } } else { header("Location:signup.php?log=Upload an image for your profile."); exit; } And the HTML part: <tr> <td>Picture</td> <td><input name="imgfile1" type="file" id="imgfile1" /></td> </tr> <td><input type="submit" name="Submit" value="Submit" /></td> Why is IE the only browser having this issue? Any help would be greatly appreciated. Thanks! Link to comment https://forums.phpfreaks.com/topic/57888-solved-php-image-upload-problems-with-ie/ Share on other sites More sharing options...
xyn Posted June 30, 2007 Share Posted June 30, 2007 try... $img_arr = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/jpeg' => 'jpeg', 'image/gif' => 'gif', 'image/X-PNG' => 'png', 'image/PNG' => 'png', 'image/png' => 'png', 'image/x-png' => 'png', 'image/JPG' => 'jpg', 'image/GIF' => 'gif', 'image/bmp' => 'bmp', 'image/bmp' => 'BMP', ); Link to comment https://forums.phpfreaks.com/topic/57888-solved-php-image-upload-problems-with-ie/#findComment-286837 Share on other sites More sharing options...
Padgoi Posted June 30, 2007 Author Share Posted June 30, 2007 Still having the problem in IE, seems to be only Verizon cuz I tried it using my IE and it worked fine. Link to comment https://forums.phpfreaks.com/topic/57888-solved-php-image-upload-problems-with-ie/#findComment-286845 Share on other sites More sharing options...
redarrow Posted June 30, 2007 Share Posted June 30, 2007 post a link i trie it m8. Link to comment https://forums.phpfreaks.com/topic/57888-solved-php-image-upload-problems-with-ie/#findComment-286846 Share on other sites More sharing options...
Padgoi Posted June 30, 2007 Author Share Posted June 30, 2007 http://www.manymates.com/signup.php Link to comment https://forums.phpfreaks.com/topic/57888-solved-php-image-upload-problems-with-ie/#findComment-286851 Share on other sites More sharing options...
corbin Posted June 30, 2007 Share Posted June 30, 2007 The problem is that you're checking MIME types, and IE does not use the standard image/jpeg anymore (sorry, I've forgetten the new one! Looking for it now!). Just to make sure this is the problem, try changing the following: else { header("Location:signup.php?log=You tried to upload wrong file"); exit; } To: else { echo 'Wrong MIME type'; exit; } Link to comment https://forums.phpfreaks.com/topic/57888-solved-php-image-upload-problems-with-ie/#findComment-286859 Share on other sites More sharing options...
Padgoi Posted June 30, 2007 Author Share Posted June 30, 2007 Yes, that was the problem, I changed it and same problem, it said "Wrong MIME Type." Now how do I fix this? Any help please? Link to comment https://forums.phpfreaks.com/topic/57888-solved-php-image-upload-problems-with-ie/#findComment-286867 Share on other sites More sharing options...
Padgoi Posted June 30, 2007 Author Share Posted June 30, 2007 how do i disable MIME type checking? Link to comment https://forums.phpfreaks.com/topic/57888-solved-php-image-upload-problems-with-ie/#findComment-286870 Share on other sites More sharing options...
corbin Posted June 30, 2007 Share Posted June 30, 2007 Ummm.... I don't remember what the MIME type of an image is in Internet Explorer.... You could either figure that out and add it to the array, or you could just remove that if() clause. Link to comment https://forums.phpfreaks.com/topic/57888-solved-php-image-upload-problems-with-ie/#findComment-286871 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.