I've had a little feedback on SWFUpload. And you might want to thumb through the comments for a few hints (there aren't that many).
Macs (they always gotta be different)
It seems on Macs that if your 'upload_backend' does not return any data that the UploadComplete event will never be called. This seems to happen for any browser which indicates that is probably an issue in the Flash for Mac implementation. So, instead of just having a blank page for your 'upload_backend' just throw in some text like, Thank you. Upload Complete. That, reportedly, will solve the problem.
IOError (specifically, Firefox for Windows)
If you get an IOError then you may not be able to upload any more files. The report says the Open File dialog will no longer open. For me the Open File dialog does appear and the UploadStart event gets called but then I never get any UploadProgress callbacks.
Solution: Handle this some way in your error handler. You could alert the user to reload the page. Or use Javascript to remove the offending Flash movie and reload it then let the user know that she needs to try again.
Better Solution: Fix the upload.swf. I realized that the logic in my changes to the Flash file was not very good. When an error occurred upload.swf would just stop processing the queue. Then when you tried to add more files it just tried to upload the erred out file again. So, I've fixed that. There still seems to be occasions when upload.swf just stops responding and you can't get the Open File dialog to come up. You may still have to rely on the "reload the movie" solution discussed above. This still feels like a deeper flash issue that may be part of the immaturity of the file upload features of Flash itself.
Firefox, Cookies and Sessions
I've finally started implemented SWFUpload in one of my own projects. It's been quite the challenge. It turns out that in Firefox for Windows that when SWFUpload uploads the file it sends the Cookies from Internet Explorer. So that means the session set up by ASP.Net (the session_id is stored in a cookie) for Firefox is not re-established when SWFUpload makes the upload. This is a problem I can't fix. I have had to change the way I link the form that my user is filling out and the files she upload since they're submitted separately and I can't rely on any session values.
Another Feature
I also added an upload limit feature. You set the upload limit when instantiating the SWFUpload object and, even if the user queues up more files, the movie won't upload any more files than the limit. I added a new error code (-60) to report back on files rejected because the upload limit has been reached.
Isn't implementation grand!
Deleted - Reeks of blogospam. Please post comments relevant to the discussion. -- Jake
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThank You - you save my Live.
ReplyDeleteI coded for a view days on my own swf upload and all look nice but later i recognize that it isnt work on the MAC. After few hours of searching i would delete all my work and go home.
But then i fount your livesaving Blog
Kim
Hi,
ReplyDeleteI am using swfupload for uploading files. i used the simple example given in the swfupload website. it works great on mac firefox,safari and opera. but it fails in windows IE6.0. It works in IE if i remove the form tag. i have the swf code inside a form tag. While searching about this issue, i found your post abt the issues you had. i am not sure whether our issues are same and i am not using ASP.NET. i tried copying your updated script and html, but not able to get it to work. keep getting this error when i click on select file
Could not call uploadImage
i read in your blog that you have updated the cod.e Could you please email it to me at editor deleted email ? Thanks a bunch.
Like Anjana, would I too be able to get a copy of your code? ([email deleted by editor]) -Dave.
ReplyDeleteI hope ya'll are having fun with SWFUpload. Implementation can be hard. This definitely isn't beginner level stuff.
ReplyDeleteIf anyone has some place to host the sample files (or can suggest a free host) I'd be grateful.
Follow-up - I'm using Coldfusion for my example. Just wanted to let you know that your code is working well!
ReplyDeleteApart from change the file types from".aspx" to ".cfm", in the index page you need to change:
upload_backend: "upload.aspx",
to
upload_backend: "upload.cfm",
and change the code in upload.cfm to:
<cffile action="upload" destination="your path" filefield="form.filedata">
For the above cffile hint I must credit Chris' comment on the ajaxian blog.
Thanks again for sharing your work!
-Dave.
It's been a long time since I've coded any ColdFusion (v 4.5). I'm glad it is working for you. I should do a posting about receiving the file from SWFUpload and covering the basics and some gotchas. I have been primarily working on the front end and was ignoring the upload part.
ReplyDeleteI did a packet sniff to discover what field names SWFUpload was using to send the file. It also sends the file name in another field but I can't recall the name. It's probably "filename" or something.
I was wondering if you have had any trouble keeping the session tied together with the file upload? I'm not sure that Flash sends the proper cookies all the time. In ASP.Net my user's session is not being maintained correctly. I have to pass in a value on the "upload_backend" like " receiveupload.aspx?specialvalue=abcdefg"
This isn't really the ideal solution.
Hi Jake, am interested in trying out your modifications.. could you please email it to me at: [email deleted]. Thanks :)
ReplyDeleteCan I please get a copy of your code also? I am trying to get it to work with coldfusion also. thanks. dewm@dewrox.com
ReplyDelete