jackofalltrades Posted February 23, 2009 Share Posted February 23, 2009 I am stumped as to why I am getting this error only with these filetypes. I have attached my php code. Any help greatly appreciated. Thank you for any help you can give. I really appreciate it. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/146553-solved-please-attach-valid-file-type-error-when-attaching-jpg-or-png/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 23, 2009 Share Posted February 23, 2009 The code displays the same error if the $attachment_Size == 0, $attachment_Size >50000, and $attachment_Mime_Type is not one of the listed values. How do you know from that which condition is failing? You need unique error messages for each possible condition. The $attachment_Size == 0 will also be true for upload errors, which you need to check first before you access any of the uploaded file information - http://us2.php.net/manual/en/features.file-upload.errors.php Also, when a test fails, you need to display the value that is failing so you get feed back as to why it failed. If the $attachment_Mime_Type test fails, display $attachment_Mime_Type in the error message so that you can see what value it has in it. You also don't need to unlink() the temporary uploaded file because it is automatically destroyed when the script ends. Link to comment https://forums.phpfreaks.com/topic/146553-solved-please-attach-valid-file-type-error-when-attaching-jpg-or-png/#findComment-769397 Share on other sites More sharing options...
Brian W Posted March 25, 2009 Share Posted March 25, 2009 funny he would post again his same problem... good catch PFMaBiSmAd Link to comment https://forums.phpfreaks.com/topic/146553-solved-please-attach-valid-file-type-error-when-attaching-jpg-or-png/#findComment-793659 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.