matlyn Posted February 13, 2007 Share Posted February 13, 2007 I have the following code in my php file that handles a user photo from a HTML upload page. I am using the code below to see if they are attempting to upload a file other than a jpg file: ... $userfile_type = $_FILES['image']['type']; // Check to see if uploaded image is a jpg if($userfile_type != "image/pjpeg"){ ...etc I have had many users upload jpg files without a problem but some users will fail this test (i.e. the file they are uploading is not recognized as a jpg file). However, if they email me the jpg photo and I upload the exact same file, no problem. This makes me think that it is a browser problem. I am using IE7. Do you think that the browser is the place to look for my users problems or what? Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 Yes. IE6, Fx and other browsers report other types. jpg can also be image/jpg or image/jpeg Quote Link to comment Share on other sites More sharing options...
JJohnsenDK Posted February 13, 2007 Share Posted February 13, 2007 You should put in these: $userfile_type = $_FILES['image']['type']; // Check to see if uploaded image is a jpg if($userfile_type != "image/pjpeg" || $userfile_type != "image/jpeg" || $userfile_type != "image/jpg"){ ...etc or make a javascript which checks the browser and tell the user that he or she have to install IE7 to be able to upload images. Quote Link to comment Share on other sites More sharing options...
matlyn Posted February 14, 2007 Author Share Posted February 14, 2007 Thanks. That's exactly what I needed to know! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.