When uploading a file using the jquery. uploadify plug-in firefox, an HTTP 302 error occurs.

Source: Internet
Author: User
Tags zend framework

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.