Jump to content

[SOLVED] File upload - Mac / jpg issue


BarneyJoe

Recommended Posts

Not sure what's wrong here - basically have a file upload script that's been working fine, but a colleague has just been unable to upload a jpg on his Mac.

 

It's not the file, as it works fine on a PC.

 

The code looks like :

 

$ValidationFailed = false;



if (($_FILES["uploadFile"]["type"] == "image/gif") 
|| ($_FILES["uploadFile"]["type"] == "image/pjpeg")
|| ($_FILES["uploadFile"]["type"] == "image/tif")
|| ($_FILES["uploadFile"]["type"] == "image/png")
|| ($_FILES["uploadFile"]["type"] == "image/photoshop")
|| ($_FILES["uploadFile"]["type"] == "image/bmp")) 
  { 
  if ($_FILES["uploadFile"]["error"] > 0) 
    { 
     $ValidationFailed = true; 
     $FTGvalid_file_errmsg = "Error: " . $_FILES["file"]["error"]; 
     $ErrorList .= $FTGvalid_file_errmsg . '<br/>'; 
    } 
  } 
else 
  { 
  $ValidationFailed = true; 
  $FTGvalid_file_errmsg = "Please select a valid image file type. The library supports .jpg, .gif, and .png files."; 
  $ErrorList .= $FTGvalid_file_errmsg . '<br/>'; 
  }

 

Any ideas why it should be fine on a PC, but not like it on a Mac?

 

Cheers.

Link to comment
https://forums.phpfreaks.com/topic/72310-solved-file-upload-mac-jpg-issue/
Share on other sites

Cheers.

 

Turned out it was this line :

 

|| ($_FILES["uploadFile"]["type"] == "image/pjpeg")

 

It originally didn't like just 'jpeg', but worked with 'pjpeg'.

 

Macs however prefer 'jpeg', so I just added the line :

 

|| ($_FILES["uploadFile"]["type"] == "image/jpeg")

 

So now it works on both.

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.