Hi,
When I upload a flash file, the uploadSuccess and uploadComplete events are not firing. My upload.aspx page is returning a status code of 200 and the file does indeed get uploaded, but I can't start the next upload. When I upload images, the events fire as expected.
Do you know what the problem might be?
Thx.
February 25, 2008 - 12:40pm
Are you returning something? In some browsers you must return some text from upload.aspx. I've also found that if I call Response.end(); that in some cases it causes an IOError.
Usually you can just call something like Response.Write("File Uploaded"); and that will work.
For some reason Flash will not trigger the uploadSuccess event unless some data has been returned.
February 27, 2008 - 6:11am
That did the trick.
Thanks for all your help so far.
May 7, 2008 - 6:16pm
I've encounted this problem when trying to upload files to Amazon S3. The uploads are successful but SWFUpload appears to stall at the end.
The S3 API allows you to set a preferred response code to POST uploads using the success_action_status parameter as follows:
If the value is set to 200 or 204, Amazon S3 returns an empty document with a 200 or 204 status code.
If the value is set to 201, Amazon S3 returns an XML document with a 201 status code. For information on the content of the XML document, see POST Response Body.
I cannot use 201 as SWFUpload considers that to be an error response. There does not appear to be any way to send text along with the 200 or 204 responses.
Is there any way to work around this, e.g. by modifying the JavaScript?
May 7, 2008 - 7:24pm
If you use the Flash 8 version you are not required to have text returned. Combine that with the success_action_status=200 parameter and you should be set.
The Flash 8 version, however cannot send additional POST variables, I'm not sure if S3 needs any other parameters.
Alternately, you can re-compile the Flash 9 version of SWFUpload and instead of using the SERVER_DATA event use the UPLOAD_COMPLETE event. The UPLOAD_COMPLETE event still requires the 200 status code but does not require any text be returned. You'll also retain the ability to send additional values via POST.
In a future version of SWFUpload this will be made an option.
May 8, 2008 - 5:28am
S3 requires a number of post fields along with the upload, so this will be Flash 9 only.
Unfortunately I don't have the Flash CS3 software, but if you were able compile a modified version and make it available for download, I and probably many others would be very grateful.
May 8, 2008 - 1:30pm
SWFUpload is 100% open source. Here's how:
Download and "install" the Flex 3 SDK
Download and install FlashDevelop (make a contribution! They make SWFUpload possible!)
The SWFUpload zip package already includes the FlashDevelop project. It's just a matter of making your code changes and compiling.
Adobe provides (pretty good) documentation at their LiveDocs site
------
You'll need to make changes at lines:
265
755
1012
to update/replace the Server Data event with the regular Upload Complete event.
------
However, this will be an option in a future version of SWFUpload (probably version 3) but you might not want to wait that long.
May 8, 2008 - 4:55pm
Thanks I will try that soon. I've written up some lessons learned here: http://blog.deskcaster.com/2008/05/08/flash-based-uploads-to-amazon-s3/
May 8, 2008 - 6:40pm
http://swfupload.googlecode.com/svn-history/r749/swfupload/branches/Amaz...
There you go. Let me know how it turns out. Especially how uploading to 3rd party site works out for you.
-----
The above special version does not retrieve Server Data. Otherwise it behaves the same. The uploadSuccess server_data parameter will always be null.
This "special edition" is based on the latest SWFUpload beta but that should just fix bugs or extend functionality. It should be a simple drop-in replacement.
June 10, 2008 - 1:40pm
Has anyone gotten this new swfupload_f9.swf (r749) to work? It is still hanging at the end of the download when an empty 200 response is sent back from Amazon for me.
June 19, 2008 - 6:19pm
No luck here from the new swfupload_f9.swf also.
Even went in with the current beta code, and made the changes in the v749 diff for S3, and compiled my own, but it still hangs at 100%. The Event.COMPLETE signal fails to fire just like DataEvent.UPLOAD_COMPLETE_DATA was, so we're no further than before.
June 19, 2008 - 7:36pm
Ok, this only seems to be a problem on non-windows platforms. Trying in windows, my hand-compiled version works great, but hangs forever (because of the above failure to fire Event.COMPLETE) on a mac (and presumably linux, etc.).
Using FF 2.0.14 (or whatever the latest pre-v3 version is) on all platforms.
November 28, 2008 - 6:46am
hi andy ,
i m trying to upload a file from Flash CS4 using FP10 on S3 Amazon. but it keeps on returning this Message: "POST requires exactly one file upload per request" and ErroCode: Invalid Argument. i received this message in UPLOAD_COMPLETE_DATA handler.
on the other hand, if I use a simple html form to uplaod the file it works fine but when i use flash upload to do the same then it return this err.
i searched the Message: "POST requires exactly one file upload per request" on docs.amazon
i found this message along with the ErrorCode different from what i am receiving here.
As per the Subject of this Posts "S3 requires a number of post", what it means? i mean do I have to send another param with no.of posting params with the request data. plz elaborate it clearly.
can u help me out plz?
thanks
November 28, 2008 - 7:31am
Solution found.
i eventually got the solution of my posted problem.
dont call upload with one arg only, specify all args
in order to uplaod a file using Flash call uplaod method like this;
upload(request:URLRequest, uploadDataFieldName:string, testUpload:boolean);
fileRef.upload(requestObj,"file",false);
set all these args like above and it will works
December 1, 2008 - 11:43am
SWFUpload all makes the upload call like you specify.
SWFUpload v2.2.0 adds a new setting: http_success which takes an array of HTTP status codes that will be treated as a successful upload. This should make working with S3 easier.
March 23, 2009 - 3:53pm
Still having issues with http_success. It's hanging when I'm uploading to amazonS3 even when I have response code 303 (redirect) inside of the http_success array. I'm also on a mac with firefox3. Anyone else seen this?
March 23, 2009 - 4:26pm
Apparently the Flash Player does not report redirects to us to handle. You'll probably have to use a different response code.
I recall that other users have had trouble with redirects on Mac clients. As far as I know they've had to get rid of the redirect and access the resource directly.