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