Jump to content

Cannot upload jpg or png but can upload other file types


jackofalltrades

Recommended Posts

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]

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){ 

 

 

 

 

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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.