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.
Returning something
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.
That did the trick. Thanks
That did the trick.
Thanks for all your help so far.
Amazon S3
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?
Flash 8 version
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.
S3 requires a number of post
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.
Open Source
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.
Thanks I will try that soon.
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/
Okay you've got me interested
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.
S3 status
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.
Problem still there
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.
re: Problem still there
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.