Not sure how useful this is going to be for anyone else, but I was on the verge of throwing my computer out the window earlier today while trying to get Uploadify to work on Mac OS. I eventually found a solution, so I was more than eager to share, just in case anyone else is scratching their head over this issue.
Uploadify was working perfectly on ALL browsers on Windows- files were uploading beautifully. But for some obscure reason, when I used the jQuery Uploadify plugin on a Mac, I kept getting returned with a “HTTP 401 error” when trying to upload files. I was literally scratching my head for hours. As a result, I completely stripped the script, and I eventually discovered the source of the problem.
Yes, that’s right. I had .htaccess/.htpasswd password protecting the directory the uploadify script was in. All other browsers on Windows (including Safari) managed to deal with .htaccess/.htpasswd just fine, but not Safari on the MAC. When uploading files on a Windows browser, the username/password box would popup, and I would fill in the details, and the files would complete uploading just fine. However, Safari on a MAC doesn’t popup with the username/password box in that situation, it just returns the 401 error. I understood why the error was occurring, because Uploadify runs a script in the background to upload the images, and that page requires authenticating with the username/password. But I was just surprised that all browsers on Windows managed to force the username/password box to popup when the upload file was being run, but Safari on the MAC couldn’t do that, hence the error.
The first solution is to exclude the upload file from being password protected. You will need to modify the htaccess file with something like this:
1 2 3 4
<Files "exclude_upload_file.php"> Satisfy Any Allow from all </Files>
Second solution is to simply remove the htaccess password layer all together (if that’s an option), and use an alternative method of securing the area e.g. a PHP session login system
So essentially, if you’re experiencing a problem with Uploadify on a MAC OS, and you’re protecting the directory with htaccess/htpasswd, remove the password protection layer, and see if that helps.
Hope this tip helps someone else out there, even if only one person.
Learning & sharing
This is where we store some of our Web Development thoughts, tips and tricks for both our own uses and for others to learn from. Sharing is caring.
Please feel free to contribute to our blog posts; perhaps even teach us a few tricks of your own. We'd love to hear your thoughts.