When uploading a file using the jquery. uploadify plug-in firefox, an HTTP 302 error occurs.
Solved the frequent chrom crash of the uploadify plug-in and encountered new problems. The ff browser reported an HTTP 302 error,
In the ff browser, uploadify uses flash for post upload without containing the original session information. Instead, it creates a new session. The new session cannot pass logon verification and is redirected to the logon page.
The solution is to post the original session to the server, and change the session to be verified to the one that is post before the server logon verification... (Language organization capability is too poor -,-).
When jquery. uploadify is initialized, add:
Copy codeThe Code is as follows:
'Formdata': {'<? Php echo session_name ();?> ':' <? Php echo session_id ();?> '},
On the server side, because the project uses the zend framework, all controllers inherit from Seed_Controller_Action4Admin. Modifying the base class may cause other problems. Therefore, the base class is not changed. Only the init () method of the application controller is changed.
Copy codeThe Code is as follows:
Public function init (){
$ Session_name = session_name ();
If (! Isset ($ _ POST [$ session_name]) {
} Else {
Session_id ($ _ POST [$ session_name]);
// This line is available on the uploadify official website, but when I join this line, the session startup error is reported.
// Normal after Removal
// Session_start ();
}
}
Here we found a problem: all the actions for uploading images should be put in one controller. during development, we were lazy and put the action for uploading images together with the actions on other rendered pages, the init method is overwritten, so several other actions do not perform logon verification during access...
Although the HTTP 302 problem is solved, alas... Still unreasonable.
In the end, this problem is still not solved perfectly. If you have any better solutions, please let us know that this article is continuously updated.