Tuesday, April 24, 2007

SWFUpload R5 Release!

I'm happy to announce the release of SWFUpload R5 (my heavily modified version of the original SWFUpload).

I'm also pleased to announce that Tarkheena has graciously provided hosting for the SWFUpload R5 demos and downloads.

And a final thanks to Lars and the SWFUpload team. They have created a great upload control and it's been great expanding on their work.

SWFUpload R5 New Features and Changes
  • Tested and Fixed the automatic cookie passing feature. It works now.
  • Switched to PHP for the demo format.
  • Switched from Flash Studio 8 to FlashDevelop. This is an Open Source Flash IDE that works great. I seem to have been able to work around the bugs found when SWFUpload v1.0.2 moved to FlashDevelop. This move allows anyone to modify the SWF file. Not just people who can afford Adobe's Flash Studio.
  • Greatly improved the callback system. You no longer pass in a string with the function name to the settings. Now you pass in the actual Function reference. This gets rid of the flashReady_callback handler, which always felt wrong, and makes more advanced things possible with multiple instances. This also allow the this object to refer to the SWFUpload instance inside the Event Handlers.
  • Renamed just about everything to make the settings and functions more consistent and clear. Replaced the -XX error codes with names and other such niceties.
  • File Selecting is now subject to the FileUploadLimit. E.g., if the upload limit is 10 and the user attempts to queue 11 files then an error is thrown. Or if the file has queued 10 files and attempts to queue 1 more then an error is thrown.
  • Returns a sensible error when Zero Byte files are uploaded.
  • You can change the UploadTargetURL at anytime using the SetUploadTargetURL function.
  • Improved the SWF to Javascript debugging.
  • Improved the encoding of strings.
Demos and Download

You can try out the demos and download the source at http://swfupload.praxion.co.za/index.php

Please note: there is a 2MB upload limit on this server regardless of what SWFUpload allows. I'll see if I can get this fixed soon

9 comments:

  1. Anonymous5:36 AM

    Great Work, i've just modified one line of your code that should be interesting to add.

    swfuploadr5.js, line 276, i have added :

    275.} 276.this.AddSetting("upload_backend", upload_backend);
    277.
    278.// Build the parameter string


    This setting allows me to inject form variables in the doSubmit() function :

    upload_backend = swf_upload_control.GetSetting("upload_backend"); swf_upload_control.SetUploadTargetURL(upload_backend+'&title='+get_element_by_id_value_title);

    So that i keep the cookies info while rewritting the URL.

    ReplyDelete
  2. I love what you are doing here. But one major problem I and many others have with flash uploads is that it doesn't return anything after upload. I was googling around and found this post which you might find interesting. The bottom reply points out a possible solution to this problem.

    I tried to implement it myself but I was unable to get MTASC to compile the swf. Maybe you could try it and see if it works?

    ReplyDelete
  3. @samuel adam: Thanks, I'll fix that. I am also adding the ability to pass in other parameters (in addition to cookies)

    @pplante: I'll look at it. This a Flash Player 9.0 only feature but is so useful we will have to make it work.

    ReplyDelete
  4. Yeah after I posted my comment I realized that it was an AS3.0 addition. However like you said this is something that would be so useful to have.

    I think with Adobe's auto update functionality we can just force users into Flash 9, or drop back to a traditional HTML file upload box.

    Right now I am going to hold off on implementing SWFUpload into my application because I need to talk to my web server after an upload. I can write Javascript code to do this but I would rather see this functionality put into the Flash component.

    Thank you for your efforts!

    ReplyDelete
  5. What a great modification. I found it doesn't work with Ubuntu Firefox 1.5.x (with flash 9 loaded) although the original SWFUpload mostly worked.

    ReplyDelete
  6. Thanks for the kudos and the bug report. I am installing Ubuntu this weekend and I'll test it out.

    I am also prepping an R5.2 release that fixes some bugs, improves code design, includes a new demo and is actually tested ;)

    Disclaimer: My testing is done in Firefox 2 and IE 6 on Windows XP.

    ReplyDelete
  7. Anonymous1:28 PM

    Hi,

    I tried to upload a file on my server using your formsdemo, but although the file says "Thank you for your submission", I see no file. (I've added the line 'move_uploaded_file($_FILES["resume_degraded"]["tmp_name"], "d:/webserver/_LIBRARY/swfuploader/dummy.zip")' to the 'thanks.php' page).

    I've added 'phpinfo()' also to the 'thanks.php' page, and I see the _FILE["resume_degraded"] with an [error] => 4.
    Error 4 means 'no file uploaded'.

    I have no clue at all where to look. Disabling Javascript does do the upload.

    Any ideas are appreciated

    ReplyDelete
  8. I'm afraid you are misunderstanding the data flow in SWFUpload. Here is a short overview:

    1. index.php loads
    2. index.php loads swfupload.swf
    3. swfupload.swf sends a file to upload.php
    4. swfupload tells index.php that it is done.
    5. index.php (using JavaScript) redirects to thankyou.php (no file is ever sent to thankyou.php)

    The "resume_degraded" file you are seeing in thankyou.php is from the "degraded form" that is just a regular HTML upload form that is displayed only if SWFUpload fails to load or if JavaScript is disabled. When SWFUpload is functioning properly then it is not used.

    ReplyDelete
  9. Anonymous1:53 PM

    Sorry, ignore my previous post. I was too tired to think properly. I've figured it out.

    ReplyDelete