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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.