Uploadify does not work on password protected sites
I use the JQuery plugin Uploadify开发者_运维百科 for uploading files. It works fine in all browsers. If however I imlement a passwort protection via .htaccess like this
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /my/path/to/.htpasswd
AuthPGAuthoritative Off
Require user dev
uploadify stops working in Firefox. In Chrome it still works.
In Firefox the file select box works, but after I selected a file the progress bar does stay at 0% and the file is not uploaded to the server.
I guess the issue is somewhere with flash on password protected sites. Any ideas how I can fix this, without removing the password protection?
There is a fairly well known flash bug that breaks authentication.
Read about it here (it's for swfupload, but I'm sure it applies to uploadify as well):
http://demo.swfupload.org/Documentation/#knownissues (under 'Cookie Issue')
You'll probably have to pass session information from the upload page to the upload script.
Workarounds are posted on the swfupload site, but I can't seem to find them anymore.
They have a demo of the flash bug here: http://demo.swfupload.org/v220/cookiebugdemo/index.php
I ended up excluding the uploadify directory from authentication (so everything is still password protected, except for the file upload).
To do so, I created a .htaccess file within the uploadify directroy with this lines:
allow from all
satisfy any
This article helped a lot:
http://brett.batie.com/software-development/password-protect-all-but-one-file-htaccess/
精彩评论