HTTP Error 302...

I have just about everything working except for uploads in Firefox on OSX. I end up getting the following messages in the SWFUpload debug window:


SWF DEBUG: Event: uploadError: HTTP ERROR : File ID: SWFUpload_0_0. HTTP Status: 302.
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
SWF DEBUG: StartUpload(): Starting Upload: First file in queue
SWF DEBUG: StartFile: First file in queue
SWF DEBUG: startFile(): No File Reference found. There are no files left to upload.
SWF DEBUG: startFile(): Ending upload run.

None of the above appears when doing this from IE or FF on my XP machine. Any ideas? The fact that it's throwing a 302 makes me think it's not a client side issue, but I could be wrong.

gyphie's picture

The server is returning HTTP

The server is returning HTTP Status Code 302 which is telling the agent (the Flash Player in this case) that the file has "Temporarily Moved".

The way I understand it is that the web server sends the right URL (where the resource has been temporarily moved to) and the agent automatically makes a new request to that URL.

It looks like the Flash Player on OSX is not doing this. I think your only fix is to fix your server so it just handles the response without returning a 302 or update your "upload_url" setting to point to the URL what won't cause the server to return a 302.

lalit's picture

I faced a similar situation.

I faced a similar situation. I found out that the framework I was using (RoR) was redirecting to from one action another. I removed the code for moving control to different action and my SWFupload worked. Additionally Safari doesn't understand blank web pages as response so at least send in a " " (space) as a output of the upload target.

Hope this helps.
-Lalit

302 on Mac

Hi, I am having that very same issue. Do you have any general idea on what should be done (or avoided) server-side to prevent this from happening?

jacobwyke's picture

My Solution

I had the same issue on OS X as it doesn't like any HTTP redirect on the upload URL.

To fix it - just ensure that the upload URL is a direct URL and doesn't redirect anywhere - this means watching out for any mod_rewrite that might be active.

I also had an issue with my initial upload page being behind a cookie based login script and it doesnt look like your cookie info gets sent with the upload. This was easily fixed by adding a one time token to the post params that I could use to loosely identify the user who was uploading the file.

To avoid any of these hassles in the future I would stick to using a dedicated single script to process the upload like there is in the demos.

I found this problem today.

I found this problem today. if you have some redirect on the domain the upload will fail. This example fails even if you upload from www.frozen-layer.com

RewriteCond %{HTTP_HOST} !^www.frozen-layer.com$ [NC]
RewriteRule ^(.*)$ http://www.frozen-layer.com$1 [R,L]

To fix it just disable the redirects on the upload url, in my case I put this line BEFORE the domain redirection with the L flag to make it the last RULE it wont be redirected by the others.

RewriteRule ^(.*)add_imagenes$ - [L]

If you are using Rails you probably also need to have on your controller this:

session :cookie_only => false, :only => :add_imagenes

syedali's picture

Solution to SWFUpload on mac safari "302" error for .net 1.0

I too was having 302 error, to fix it I got rid of redirect [Response.Redirect("login.aspx")] on top of page I was using to validate session. All works fine in Safari browser for PC and Mac.