Home  >  Article  >  Web Front-end  >  Firefox browser reports HTTP 302 error when uploading using jquery.uploadify plug-in_jquery

Firefox browser reports HTTP 302 error when uploading using jquery.uploadify plug-in_jquery

WBOY
WBOYOriginal
2016-05-16 16:12:04922browse

Solved the problem of uploadify plug-in frequently crashing in chrom, and encountered a new problem, ff browser reported HTTP 302 error,

Uploadify under the ff browser does not include the original session information when uploading a post using flash, but re-creates a session. The new session cannot pass the login verification, so it is redirected to the login page.

The solution is nothing more than to post the original session to the server side, and then change the session that needs to be verified to the one that was posted before the server side login verification. . . (Language organization skills are too poor—,—).

Add when initializing jquery.uploadify:

Copy code The code is as follows:

'formData' : { '' : '' },

Since the project uses the zend framework on the server side, all controllers inherit Seed_Controller_Action4Admin. Modifying the base class is afraid of causing other problems, so the base class is not changed, only the init() method of the application controller is changed

Copy code The code is as follows:

Public function init() {
          $session_name = session_name();
If (!isset($_POST[$session_name])) {

         } else {
session_id($_POST[$session_name]);
//Uploadify official website has this line, but after I added this line, it reported a session started error
// After removing it, normal >                       //session_start();
}
}

I found a problem here: all the actions for uploading images should be placed in a controller. I was lazy during development and put the action for uploading images together with other actions for rendering pages, and the init method was overwritten. , so several other actions do not perform login verification when accessing. . .

Although the HTTP 302 problem is solved, alas. . . Still unreasonable.

In the end, there is still no perfect solution to this problem. If you have a better method, please let us know. This article will continue to be updated.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn