jackofalltrades Posted March 25, 2009 Share Posted March 25, 2009 Hi. I have a form at http://www.renderforge.com/MainSite/OrderForm.htm When visitors attempt to upload items they are send to a folder. The problem is that the form will accept most formats but NOT .jpg or .png. No problem with .jpeg, .gif.... etc. Attached is the PHP code. Any help would really be appreciated. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/151069-cannot-upload-jpg-or-png-but-can-upload-other-file-types/ Share on other sites More sharing options...
Brian W Posted March 25, 2009 Share Posted March 25, 2009 if( $attachment_Mime_Type != "image/gif" AND $attachment_Mime_Type != "image/jpeg" AND $attachment_Mime_Type != "image/jpg" AND $attachment_Mime_Type != "image/png" AND $attachment_Mime_Type != "image/tiff" AND $attachment_Mime_Type != "text/plain" AND $attachment_Mime_Type != "text/rtf" ) { that is bad, fat, and likely a pain to modify. No offense intended. try this $mimes = array( "image/gif", "image/jpeg", "image/jpg","image/png", "image/tiff","text/plain","text/rtf","image/bmp"); if(!in_array($attachment_Mime_Type, $mimes){ Quote Link to comment https://forums.phpfreaks.com/topic/151069-cannot-upload-jpg-or-png-but-can-upload-other-file-types/#findComment-793622 Share on other sites More sharing options...
PFMaBiSmAd Posted March 25, 2009 Share Posted March 25, 2009 You have an existing thread where you were told the shortcomings with the code and what to do to debug the problem - http://www.phpfreaks.com/forums/index.php/topic,240073.0.html Quote Link to comment https://forums.phpfreaks.com/topic/151069-cannot-upload-jpg-or-png-but-can-upload-other-file-types/#findComment-793648 Share on other sites More sharing options...
jackofalltrades Posted March 25, 2009 Author Share Posted March 25, 2009 OK... I now feel like a complete jerk, as I should. I accept full responsibility for such an incredible piece of bad judgment. Believe me, I try not to be a forum abuser. Just a really dumb mistake because the project got put on the back burner. I even did a search on the forums for a similar problem before I posted. Please accept my apologies everyone. Slinking with tail between legs. Quote Link to comment https://forums.phpfreaks.com/topic/151069-cannot-upload-jpg-or-png-but-can-upload-other-file-types/#findComment-793664 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.