jquery Upload Plugin uploadify an HTTP Error 302 error resolution

Source: Internet
Author: User

Previous time introduced the jquery uploadify upload plugin use method, I encountered in the use of the HTTP Error 302 error problem, there should be a lot of people encountered in the use, recorded here:
First, HTTP 302 is the meaning of the redirect request, which is easy to understand, if your uploadify processing upload script has session validation, this error occurs because Flash does not contain cookie information when it executes the POST request. The server session will be SessionID based on the client's cookie. It is not possible to get to the session without submitting a cookie, and then Uploadify returns a 302 (Request redirected) error.
The solution, of course, is to upload the session_id value to the server:

 <script>$ (document). Ready (function ()  {       $ (' #file_ Upload '). Uploadify ({          ' uploader '   :  ' uploadify/uploadify.swf ',          ' script '      :  ' uploadify.php ',         ' folder '     :   ' uploads/file ',          ' formData ': {  ' session ':   ' <?php echo session_id ();? > '},          ' oncomplete '   : function (event,  id, fileobj, response, data)  {            alert (response);         }        });  }); </script> Copy code 



Then before the server-side session is validated:

if (Isset ($_post[' Session ')) {session_id ($_post[' Session ')); Session_Start ();//Note This function to copy code after session_id}                              



Of course, you can also pass the session ID directly in the URL.

jquery Upload Plugin uploadify an HTTP Error 302 error resolution

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.