BarneyJoe Posted October 8, 2007 Share Posted October 8, 2007 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 More sharing options...
TomKrush Posted October 8, 2007 Share Posted October 8, 2007 If you are using the original install of PHP on your Mac then Uploading is disabled. You will need to edit your php.ini. Also file permissions must be set so you can write to the directory. Link to comment https://forums.phpfreaks.com/topic/72310-solved-file-upload-mac-jpg-issue/#findComment-364635 Share on other sites More sharing options...
BarneyJoe Posted October 9, 2007 Author Share Posted October 9, 2007 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 https://forums.phpfreaks.com/topic/72310-solved-file-upload-mac-jpg-issue/#findComment-365252 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.