prakash Posted January 30, 2009 Share Posted January 30, 2009 Hi I am using following condition to upload image from php. if (($_FILES["somefile"]["type"] == "image/jpg") || ($_FILES["somefile"]["type"] == "image/jpeg") || ($_FILES["somefile"]["type"] == "image/pjpeg")) { // correct image type } else { // print wrong image type } I want a condition to upload only jpg image but this code doesn't works on all jpg images. can anyone give me an idea what may be the cause / is the condition correct? Thanks Link to comment https://forums.phpfreaks.com/topic/143131-error-uploading-image-using-php/ Share on other sites More sharing options...
rhodesa Posted January 30, 2009 Share Posted January 30, 2009 in your else statement, do: print $_FILES["somefile"]["type"]; and see what the type is also...instead of checking the mime-type...you can try feeding it to imagecreatefromjpeg() and see if it returns something Link to comment https://forums.phpfreaks.com/topic/143131-error-uploading-image-using-php/#findComment-750616 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.