Tuesday, July 10, 2007

SWFUpload Revision 6.2 Release

So, here I am releasing a new version even though I said I wasn't going to. Some bugs were fixed that warranted a version change and forced me to change some functionality.

Revision 6.2
  • Fixed the Type Coercion error
  • Fixed FileComplete not firing
  • Added setting that indicates whether FileComplete or ServerData should fire (both call the FileComplete JavaScript handler)
  • Fixed a race condition (see R6 post)
  • Added API for changing all the changeable settings dynamically (file type, upload limits, etc)
  • Updated Classic Forms demo to use Server Data.
  • Updated Features demo to reflect API/feature changes
Notes:

The website has been updated. Get the latest greatest there. And as always let me know if you come across any bugs. A big thanks to all those who reported bugs in R6.

I've been concerned that people are downloading the Revisions and attempting to plop the demo code in to their own websites or apps. I strongly recommend against doing this. The Demo code is poorly designed, poorly test and is insecure. Furthermore, my PHP is very rusty and out of date.

The purpose of the demos is to give you working examples so you can see how things work since I haven't produced any documentation yet. But they are like the snippets from "Learn X in 21 days" books. They are there to get a particular point across but they do things wrong for the sake of simplicity.

As another disclaimer: I am an amatuer Flash/ActionScript developer and much of the code is derived from short examples taken from the LiveDocs. The code may be insecure and done wrong because I am guilty of using example code in to the Revisions.

So we are all getting what we pay for.

73 comments:

  1. Awesome work. Currently using SWFUpload Revision 6.2 @ www.artician.com/cp/upload/ for Art submissions. Three separate uploaders simultaneously. Couldn't have done it without this excellent script.

    ReplyDelete
  2. Wow, that was fast!

    ReplyDelete
  3. Anonymous9:23 AM

    Getting a crash and burn on SwiftFox 2 (Firefox 2 compiled for linux). The entire browser exits without a message when the upload is complete on the multi upload test, but only with the large file upload.

    ReplyDelete
  4. Anonymous9:28 AM

    The classic form also crashes out on upload completion.

    ReplyDelete
  5. I've had serious problems on FF2 in Ubuntu. I get similar crashes when canceling the file dialog.

    I don't know what to do about it, not being a flash player, linux, or actionscript expert.

    Suggestions are welcome.

    ReplyDelete
  6. Anonymous10:42 AM

    Apologies jake, just tested on the original SWFupload 1.0.2 and its got the same problem - which is going to make development a little harder than it should be :S There are comments in thier forum about it as well.

    ReplyDelete
  7. I think it a Linux Flash Player problem which means that there isn't anything I can do about it. But I don't like to cop-out just because I suspect the Flash Player. If anyone can provide more info please let me know.

    ReplyDelete
  8. Anonymous11:02 AM

    Just tried both the original and your version with FF2 and Opera on Linux - both don't like it much. Opera deals with it better, but still doest work as it should.

    ReplyDelete
  9. Anonymous5:55 AM

    Is there a way to send full text to the error_handler from the server? message just seems to be the error code from the head e.g. 500

    ReplyDelete
  10. Anonymous8:13 AM

    I have a feeling 6.2 is 5.2, I don't see a preupload handler anywhere, also you're "view blogger profile" link isn't working this might not be a problem related to swfupload.

    ReplyDelete
  11. Flash does not provide a way to get data from anything but a 200 response. In ASP.Net this is a problem since any error causes a 500 code. You have to make sure you catch everything and then return any error info you need. In PHP you can just allow it to return a 200 code and output an error information. You can then interpret the error info in the fileComplete event. The demos still return 500 codes because I haven't bothered to update that part.

    @anonymous (II): 6.2 is not 5.2. For one thing it's been moved to ActionScript 3. I'm not sure what preupload handler you are referring to. There are 2 pre-upload events. fileQueued and fileValidation. fileValidation is only fired if the validate_files setting is 'true'. The Features Demo shows how to use these events.

    Also I updated my blogger profile. in hopes that that will fix whatever issue there was with it. I can rarely see profiles for anyone on blogger. I don't know what the deal is. Hopefully mine is fixed :)

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Anonymous8:10 AM

    More error questions :

    I took your advice and used the fileComplete event to handle errors, which is good. But its lead me to a new question/problem.

    Aborted / Errored uploads still count towards the upload limit, how can you decroment this counter?

    Also, is there a simple way to check for failed uploads from the queue complete function ?

    ReplyDelete
  14. Great Code - thanks!

    The handlers i'm currently working on would benefit from a single file upload start callback preceding the upload progress callbacks for each file. Any hints on how I could implement this?

    Cheers

    ReplyDelete
  15. @anon
    There isn't a way to manipulate the successfuly upload count. You can change the upload limit dynamically in R62. You could increase it after each error you encounter.

    As for checking file status in the queue complete you could track this with your own JavaScript variables. SWFUpload doesn't maintain the information. After a file is complete (errored or uploaded) it's objects are destroyed (hopefully releasing memory).


    @degree96

    I thought about adding an upload start event but was able to work around not having one by simply using the fileProgress event and a tracking variable that I could flag whether fileProgress had been called before. Then in fileComplete and Error handlers I reset the tracking variable for the next file.

    I am not really intending any new releases for awhile. If you really need the feature you should be able to pretty easily to add it to the source for your own projects.

    Good luck!

    ReplyDelete
  16. Anonymous3:38 AM

    The queue_complete and file_complete callbacks aren't reached on Linux Firefox 2.0.0.4, Flash 9.0r31:

    Flash called back and is ready.
    SWF DEBUG: UploadFile: Browsing files. *.*
    SWF DEBUG: Event: Files Selected from Dialog. Processing file list
    SWF DEBUG: onSelect: File within size limit and of valid type. Adding to queue and making callback.
    SWF DEBUG: onSelect: Uploads set to begin immediately. Calling StartUpload.
    SWF DEBUG: StartUpload(): Starting Upload. Next file in queue
    SWF DEBUG: StartFile: Next file in queue
    SWF DEBUG: startFile(): File Reference found. Starting upload to http://localhost/devel/upload.php. File ID: SWFUpload_0_0
    SWF DEBUG: Event: Progress: File ID: SWFUpload_0_0. Bytes: 6200492. Total: 6200492

    ReplyDelete
  17. I want it to be able to select which imagealbum to upload to. So I added a select to receive the album_id.

    But when uploading the images (using debug=true) I see no post variable alb_id with the data!?

    ReplyDelete
  18. R62 does not automatically add your form's values to the post. You must do this manually.

    It's pretty easy:

    1. Make a new object: var my_post_object = {};

    2. Add items to be posted to the object:
    my_post_object["post_name"] = "post_value";

    3. Add the post object to your R62 instance using the setPostParams method: swfupload.setPostParams(my_post_object);

    4. Or add the post to an individual file: swfupload.addFileParam(file_id, "post_name", "post_value");

    It should be pretty easy to build a little JS that goes through an entire form and creates a post object, sets the PostParams and then starts the upload.

    ----
    If there is a bug in setPostParams let me know. Also, check out the Feature Demo, which allows you to see setPostParams in action.

    ReplyDelete
  19. In IE i get an error 1009 and the file is not uploaded...

    ReplyDelete
  20. Can you provide a detailed description of the problem you are having and how you get the 1009 error.

    ReplyDelete
  21. Anonymous8:24 AM

    Great job
    It works like a charms, also in spawned Ajax pages :)

    But i can't seem to get that post_params thingy working

    I looked all over the features demo and tried to get it to work but i didn't had any luck.

    I either keep recieving 'Options has no properties' (while i made them) or upload (that's what i call my SWFUpload object) has no properties while it it working..

    I hope you could provide us with a small snippit using the swfupload.addFileParam parameter cause i'm getting crazy

    Thanks in advance

    ReplyDelete
  22. Here is a snippet. Assume that I have R62 with a queue limit of 1. I have a select box with some items and a text box. The select box value needs to be sent with each file and may change with each file. The textbox is sent with every upload but shouldn't change once uploads have started.

    I also have a "browse" button that first checks that I have made a valid selection from the select box and that something has been entered in the textbox and then calls the browse() method on the R62 instance.

    Here is the fileQueued handler that will add my post values.


    function fileQueued(fileObj) {
    // Get the select box
    var select_box = document.getElementById("item_select_box");
    var selected_value = select_box.selectedValue;

    // Add the selection to the file
    // Note: in all the handlers the 'this' object refers to the R62 instance
    this.addFileParam(fileObj.id, "selected_item_id", selected_value);


    // Check to see if we have already set the textbox post param
    var post_params = this.getSetting("post_params");
    if (typeof(post_params["textbox_value"]) === "undefined") {
    var text_box = document.getElementById("important_text_box");
    var text_box_value = text_box.value;

    post_params["textbox_value"] = text_box_value;
    this.setPostParams(post_params);
    }
    }


    Additional details:
    addFileParam(file_id, name, value) adds a per file post value. Once that particular file has been uploaded then the post params are discarded.

    setPostParams(object) takes an object with the name/value pairs for the post. These are Global Post Params. They are sent with every upload and are not discarded.

    The File Post Params override the Global Post Params if there are any duplicate names.

    The Post Params object will make more sense if you understand JavaScript object literals and the concept of passing parameters in object containers.

    ReplyDelete
  23. Anonymous11:56 AM

    Jake,

    Thanks! I'll look into it, hope i can get it to work!

    It looks to damn nice to not use it :)

    Also im still learning Javascript, i got some of the JS OOP under control (using prototypeJS though.. (makes it some what easier :P))

    ReplyDelete
  24. Anonymous1:41 PM

    I keep getting errors in IE and i can't solve it, maybe im missing something (removed my cookies temp files and all other files over 100 times still no luck..)

    I get this error, it works in FF & even in Safari on windows it runs but the only browser which acts like shit is IE(7) :(

    EXCEPTION: message: 'file' is niet gedefinieerd
    EXCEPTION: number: -2146823279
    EXCEPTION: description: 'file' is niet gedefinieerd
    EXCEPTION: name: TypeError

    while it should Filedata if im right?

    Many thanks!

    ReplyDelete
  25. Can you provide more description? When does this happen? (a start-up, when a file is queued, when an upload progresses, when the upload is complete, when the queue is complete?).

    If the error occurs in a handler post your handler code. If you have a link to your test site I'll take a look at it.

    ReplyDelete
  26. Anonymous4:16 PM

    It happens only in IE7 when i file upload should be completed, then i get that IO Error

    It has to do something either with PHP or with flash, my handlers are almost a straight copy of your examples :) (Since im still kinda new to SWFUpload) so i cant figure what's wrong with it unfortunatly i don't got it only right now, got it local

    ReplyDelete
  27. Many thanks for this awesome piece of code. Keep up the good work!

    And, well, here's my feature request:
    Would it be possible to add an optional setting like "post_body" or "post_raw" that gives the ability to set the raw POST request body instead of specifing POST parameters using "post_params"? PHP provides access to this raw uninterpreted POST data using $GLOBALS["HTTP_RAW_POST_DATA"].

    This feature would be useful where the POST Content-Type isn't something that PHP understands (such as XML or JSON in my case).

    ReplyDelete
  28. I am not sure that the ActionScript 3.0 libraries work that way.

    I use the URLRequest object to send the POST data with the file upload. If you want to research it and provide a snippet for setting up the URLRequest to send raw data.

    I'm not sure what the mime type matters in this case. The POST should be sent as multipart/form-data and automatically encoded by flash. SWFUpload never specifies a content type nor restricts it to XML or JSON.

    You should be able to send any data that you can store in a JavaScript value.

    ReplyDelete
  29. To my regret, I'm not familiar with ActionScript 3.0. Nevertheless, I consultated the ActionScript Language Reference. As it seems, URLRequest has the ability to send binary POST data by assigning a ByteArray object to the "data" property. But as I learnt from the Language Reference, ByteArray isn't allowed when a file needs to be uploaded.

    Therefore I take back my feature request. Thanks anyway!

    I'll insert the JSON formatted data into a single post parameter instead.

    ReplyDelete
  30. That sounds like what I read as well (it's been awhile go however). I couldn't remember for sure.

    That does bring up a question that I'll have to check out. I have not attempted to assign complex types to any of the values (object, array, date) in the post_params. I guess I just assumed they'd be sent but now that I think about I'm not sure how. They'd have to be converted to a string somehow and I doubt Flash is going to automatically convert them to JSON.

    So, manually converting the data to a JSON string sounds like the right thing to do in this case although I imagine that it is an inefficient way to send binary data.

    Good luck with your project. I wish Flash gave us more power but I suspect browser security is a big issue that prevents them allowing a lot of 'nice' things we all wish we had.

    ReplyDelete
  31. using the formsdemo, I added:

    move_uploaded_file($_FILES["resume_file"]["tmp_name"],"uploads/".$_FILES["resume_file"]["name"]);

    to the upload.php file to have the file that is uploaded copied to an upload folder.

    The problem I've run into, is for large files, (seems like anything over about 6 megs) I get and "there was a problem with the upload" pop up error... any suggestions... smaller files work fine.

    ReplyDelete
  32. Files bigger than 6 MB don't seem to get uploaded for me either...

    Any idea?

    ReplyDelete
  33. Anonymous1:03 AM

    hi!
    i'm playing with the multiupload demo.
    I removed the auto-disappear when all are completed.
    How can I make a button to clear like the auto-disappear?

    great script!
    thanks!!

    ReplyDelete
  34. Anonymous1:55 AM

    hi,

    Would be grateful if you could let me know whether the SWFUpload (1.0.2 version) supports the flash_color and flash_height params or If I need to use your version for that. Would be eternally grateful if you could please email me at luke[at]lukem[dot][co][dot][uk]

    can't seem to get any support anywhere else!

    thanks!

    luke.

    ReplyDelete
  35. @neal & dave:
    I don't know why you would be limited to 6 MB files. In all my testing I can upload any size file. I suggest checking your web server settings which include file size limits (default in PHP is 2 MB, default is ASP.Net is 4MB)

    @JJ: All the fancy UI stuff is really out of the scope of SWFUpload. It's not really that hard though. It just takes some JavaScript and the setTimeout function. You should be able to see how I did the fade out by looking at the Handler.JS in the Multi-upload demo.

    @anon: You can get pretty good support at the official forums and from the documentation

    According to the DOCS v1.0.2 does support the flash_height and flash_color settings. It doesn't have any details but I recommend becoming familiar with the SWFUpload source code. I think it makes debugging easier to know how the settings are used in the code.

    ReplyDelete
  36. Anonymous9:38 PM

    Hi:
    I have been very busy trying to understando how to save other form fields to a mysql database. But the more I read the more confused I get.
    So far, I am able to save filename, filesize, etc.
    But let suppose that also want to save, for instance, the info in the form shown in "formdemo", I think it is called "classic".

    ReplyDelete
  37. Hello, Thanks for the nice sample, unfortunately everything is not working for me. Everything looks like it's working. It does all the job except that the thumbnails do not show up. I debugged this to the point that in fact

    function fileComplete(fileObj, server_data) {
    try {
    AddImage("thumbnail.aspx?id=" + server_data);

    is always getting undefined as server_data despite the fact that Response.Write(thumbnail_id); is sending a correct value.

    I'm talking about the demo found in Download the Revision 6.2 "Application Demo" for ASP.Net 2.0 on http://swfupload.praxion.co.za/index.php

    What can I do to help you get more info about that ? When I modify server_data by hand at execution, the thumbnails show up correctly.

    Do you think this can have something to do with the fact that I'm using the integrated web server and not a real IIS instance?

    Thanks agin for your help and for sharing this with us.

    ReplyDelete
  38. Hello people, please note that if you have the same problem then I do with the asp.net 6.2 demo, with thumbnaisl not showing up, got to swfupload.js and change the use_server_data_event from false to true. this.addSetting("use_server_data_event", init_settings.use_server_data_event, true); //from false to true
    I'm happy that this is working such nicely and that this parameter must just have been forgotten :)
    In case, you have a better idea and in case I'm not doing the correct thing, let me know ;)
    Thanks,
    John.

    ReplyDelete
  39. @Jonx: You are exactly right. I missed that when I updated the asp.net demo. I'll update the demo on the website.

    ReplyDelete
  40. Can you give an example of how to include additional data in the form post?

    I need to pass a session ID to the upload.php form...

    I tried this and it doesn't seem to do anything:

    post_params: { "sid": "my_sid_here", "dothis": "put" },

    ReplyDelete
  41. Nevermind... I found out you can pass it through the query string instead...

    ReplyDelete
  42. Setting the post_params object should work in R62. You can see it in action in the Features Demo.

    You can dynamically change the post params using the setPostParams() function.

    Furthermore you can add post params to specific queued files using the addFileParam() function.

    In PHP all the post params show up in the $_POST array.

    ReplyDelete
  43. Hi Jake,
    I was wondering if you'd be willing to take a look at my implementation of SWFUpload Revision 6.2. I have no problem using it in Safari 3.0.3 Beta, Firefox 2.0.0.x or IE 6+ in Windows XP SP2 but some of my users running OSX are being dropped off right after the file finishes uploading.

    The last line of the output is:
    SWF DEBUG: Event: Progress: File ID: SWFUpload_0_0. Bytes: 818808. Total: 818808

    The same behavior occurs in Safari and Firefox on OSX.

    ~Akujin
    AIM: HAckujin
    Email: digitalisakujin(AT)g|m|a|i|l

    ReplyDelete
  44. That's usually because you are not outputting any text in your "upload_script".

    At the end of the upload.php script you can put something like 'echo "Done";' and that should do it.

    This is an issue with the Flash Player for Mac.

    ReplyDelete
  45. jake, the was the upload problem, phpinfo says my upload limit is set to 7 megs... thanks!

    ReplyDelete
  46. Anonymous7:48 AM

    I uploaded everything as-is, but I have a couple of questions.
    *How can I get out of the demo mode so it would actually upload.
    *Where does it upload the file to?
    *Could I email all the form inputs after the file is upload it?

    ReplyDelete
  47. Unfortunatly I already have

    if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $dir['submissions_inc'] . $FILENAME)) {
    echo 'Success';

    I moved the echo further up then it was just in case but my OSX tester is still having issues. :(

    ReplyDelete
  48. All I can suggest is using an application to do a packet sniff and checking server logs to verify that the script executing without error, is returning a 200 status code and is return some kind of data. That will eliminate anything server side.

    Are you receiving the file on the server side even though the fileComplete event never files?

    Then I'd suggest using Firebug in Firefox to trace through the JavaScript to verify that there isn't some kind of obscure error occurring there.

    There are a couple odd Flash things that it could be.
    1) No data returned from the upload script breaks Macs
    2) The upload_target_url may (or may not) have to be relative to the SWF Upload script. I've heard both arguments and maybe the Mac Flash Player is one way and the PC's another.
    3) The upload_target_url should be on the same domain as the upload form. There are fancy ActionScript thingies you can do to get around them but I've ignored them all. ;)

    ReplyDelete
  49. I am returning data so I doubt it's that.
    I tried playing with the directory paths and they all work on my windows box:

    upload_target_url: "/modules/cp/submit/upload.php",
    flash_url : "../../js/assets/swfupload.swf",

    OR
    upload_target_url: "../../modules/cp/submit/upload.php",
    flash_url : "/js/assets/swfupload.swf",


    The script happens to be also two directories down (/cp/submit/).

    The behavior is the same throughout. The flash is obviously there because it sends a read signal and returns valid upload progress information.

    I could of course read the logs but at this point I feel like I'm looking in the wrong place. My tester is able to use the demo at http://swfupload.praxion.co.za/featuresdemo/index.php so I think it's something I might be doing wrong. Is there any way that the Flash or the JS could be confusing the uploaders if there are multiple uploader objects. (3 in this case)

    ReplyDelete
  50. Anonymous4:07 AM

    i have a bug on Firefox, when i upload my session cookie is not the same that is on the browser. So i can't upload correctly my file. Moreover, how can i change the content-type (application/octet-stream) to the file type??

    plz help me!! thanks

    ReplyDelete
  51. @garvey:

    The cookie issue is a known bug in the Flash Player. The best you can do is pass the correct session value from the browser to the script and manually load the session. In PHP is this is trivial. In ASP.Net it may be impossible. I'm not versed in other tech so it may or may not be possible in your situation. It kinda sucks all around.

    I don't think it is possible to change the content-type. Flash does not provide an API for doing this. It is somewhat unfortunate that Flash uses such a generic mime type. But I've never much trusted mime types anyways.

    ReplyDelete
  52. @akujin: It looks like you have posted to the official forum with some code. I prefer using the forum and I've posted a response.

    ReplyDelete
  53. Any one tested it on https / SSL site , i get an error as IOError using Mac and Firefox 2 , does anyone successfully use this on https ?

    ReplyDelete
  54. Great work.
    I have a question though: is there a particular reason why in the FileComplete_Handler the callback is called before the internal UploadComplete function? The reason I ask is that I would like to manually start the next upload when an upload finishes and obviously I get the error that the uploader is still working. So my suggestion would be something like this:
    var current_file_jsObject:Object = this.current_file_item.ToJavaScriptObject();
    this.UploadComplete();
    ExternalInterface.call(this.fileComplete_Callback, current_file_jsObject, event.data);

    ReplyDelete
  55. I guess it is a matter defining what "upload in progress" means.

    I defined it as the upload attempt completed and all related events fired. This of course means that an upload in progress has not finished until after fileComplete is called.

    I think your changes will work fine for what you want to do but if you switch from single file uploading to queue uploading you might get some event sequence problems. (Worst case is that the fileComplete events get fired in reverse after uploading several files). But then again you might not. It depends on how fast things happen and how Flash queues asynchronous events.

    ReplyDelete
  56. Thanks for your answer, Jake. My problem is that the uploader doesn't give me access the it's internal queue so I can't control the order of upload and can't ignore elements in the queue (I explain this later). So I am managing a queue myself in javascript and whenever the upload finished event is fired I am advancing to the next file in my queue and call the start upload on the uploader. This is where it fails because the uploader didn't really finish "this.current_file_item != null" so I had to call it with setTimeout (ugly).
    Another problem that I have with the queue is that I want to set additional form parameters to the uploaded file which is applied AFTER the file is added to the queue. So if the "begin_upload_on_queue" is true then my file might get uploaded before the form parameters are applied. That's another reason why I want to manage the queue myself. Do you think these might get fixed in the future? Basically some functions to access the queue would be sufficient (get the list, change the order) and the items should have a flag (like skip) so it would not be processed until it is cleared.

    ReplyDelete
  57. I agree that working around timing issues with setTimeout is ugly.

    The solution I came up with is to add a FileDequeued event. This wouldn't cause any weird asynchronous call issues. And at that point the upload would really be complete.

    Then your workflow would be: FileQueued(fileObj), FileProgress(fileObj, etc), FileComplete(fileObj) or Error(fileObj, etc) or fileCanceled(fileObj), FileDequeued(fileObj).

    ------

    The Revisions are designed with the vision that you would manage most of the advanced stuff in your own JavaScript. That's why there are all the events and very minimal built in UI manipulation.

    Currently you can do a lot with the queue. fileQueued gives you the fileObj (which includes the ID). And StartUpload accepts an optional parameter (the ID) that allows you to start the upload of any file you want. So you can call StartUpload("SWFUpload_0_10") to start the upload on that file even if it's out of order.

    ------
    Your questions have started me thinking about the overall work-flow and I guess I'll start map out and revisiting how things have evolved up to this point. It's probably a good time for a code and architecture review. No promises on when that will be but it sounds like we will have a Revision 7 sometime soon.

    ReplyDelete
  58. Thanks Jake,

    Is there a tutorial or something about how can one recompile the flashDevelop project files, so I can play around with the code? I installed FlashDevelop 3 but when I try to compile the project it fails with an error on the first line saying "Parse error, unexpected package". Any ideas?

    Thanks a lot.

    ReplyDelete
  59. Jake, would you need some space on a server to host your files/project/samples? I can probably share some space with you if you need to. Get in touch with me if it's the case ;)
    Thanks for your work...

    ReplyDelete
  60. Anonymous5:46 PM

    hello colleagues, I have a small problem: it shows a IO error to me, at the time of initiating the ascent with protocol SSL/HTTPS.
    I thank for the aid
    thanks

    ReplyDelete
  61. Anonymous8:18 AM

    Is there any way of only letting the use select 1 file at a time?

    After an upload is complete I launch a thumbnail tool in a popup but if more then one file is selected this causes a problem.

    ReplyDelete
  62. You cannot prevent a user from selecting multiple files in the file dialog (I've been meaning to look in to this) however, you can limit the number of files that can be queued.

    Using the "file_queue_limit" setting you can limit the number of files that can be queued to 1. Then if the user selects 2 or more the 1st file will be queued and the others will cause the Error callback with ERROR_CODE_QUEUE_LIMIT_EXCEEDED; which you can handle or ignore.

    ReplyDelete
  63. Have you set the "validate_files" setting to true?

    ReplyDelete
  64. yes... I have
    validate_files : true,

    that's why it is puzzling

    ReplyDelete
  65. I recommend posting at the official SWFUpload forum with your configuration details. I hang out there and it's much easier to work things out in the forum than in these blog comments.

    SWFUpload website

    ReplyDelete
  66. Anonymous12:50 PM

    You seem to have lost the per-file notification of upload start. This is a very useful callback, esp. as I can not fake the event using the progress callback. For small files the progress callback is never run.

    ReplyDelete
  67. I didn't realize that progress was not always called.

    In Revision 7 I have redesigned the events. I re-introduced uploadStart which also fills the role of fileValidate (so fileValidate is gone).

    I still have some issues to work out but it's coming along nicely and hopefully I'll have a release sooner than later.

    In the meanwhile, the FlashDevelop 3 beta supports ActionScript 3.0 and you could probably pretty easily add the startUpload again if you really need it right away.

    ReplyDelete
  68. Hi there,
    Looks good, tho Im wondering if anyone has used this with cakephp yet? Thanks,
    Aeshan

    ReplyDelete
  69. If you look around the SWFUpload Forums you can find some info on CakePHP. I think someone even wrote a module (or whatever they call it) to assist the SWFUpload <-> CakePHP interaction.

    ReplyDelete
  70. Anonymous4:31 PM

    I'm a Macintosh developer, so I'm pretty limited in the OS tools I can use for Flash/AS development. Both my boss and I are happier with eternally supplied/updated tools, anyway. ;)

    On the other hand, the JS interface to the Flash is a mess, at least with 6.2. I've been able to simplify the entire Flash method calling process by virtue of extracting the redundant code. There's a bug in Flash I had to work around (functions not being a Function()) but I removed nearly 10 lines of code per function. I also replaced the entire custom debugging system with references to FireBug's console.

    See: http://www.orianagroup.com/upload/

    View the source of upload.js to see what I've done. I'll be continuing to update it today to remove direct DOM manipulation. The office here is standardizing on jquery, so... :P

    ReplyDelete
  71. Your method for making Flash calls is very nice.

    I wasn't able to run the code unfortunately. You are calling initDebug() too late. It should be run before the entire "try..catch" in the constructor. If there an error occurs during the initial setup "this.console.error" will be called but it hasn't been setup yet so the script craps out (The exception model doesn't seem to address exceptions in catch blocks).

    I decided against using the Firebug console (but I guess I could) because the IE adapter wasn't out when I started and I needed it to work in all the browsers I test in.

    Too bad there isn't a Firebug for IE, Opera and Safari.

    ReplyDelete
  72. Anonymous5:18 PM

    I've fixed the debugging problem. I've added a stub to index.html, which I'll be splitting out into a separate .js file for convenience. FirebugLite

    Firebug Lite is what you're looking for:
    http://www.getfirebug.com/lite.html

    They're first paragraph start: "Firebug is an extension for Firefox, but what happens when you need to test your pages in Internet Explorer, Opera, and Safari?"

    And remember: my entire script is under active development. ;^) The design goal was to produce an image batch uploader to replace an existing anonymous FTP system. Gah. I decided that I liked the look of Flickr's uploader. :P

    (Note that currently IE6 does bad things to the CSS of my interface. IE7, FF, and Safari are all perfect.)

    ReplyDelete
  73. Yes, FireBugLite. It wasn't out (or I didn't realize it was out) when I started and I was too lazy to convert when I found out it was there. I didn't realize that I could write to FireBug's console until I read about FireBugLite.

    Anyway, your app looks very nice. I like the bouncy effects. They are pleasing and effective. It works like crap in IE and that's the only browser that works through our corporate firewall. I'll have to try it again from home this evening.

    I've taken a couple of looks at jQuery (watched some YUI videos too) but I haven't used it yet. I'm reluctant to tie SWFUpload to any external libraries.

    I don't like 3rd party libraries very much (I must have some kind of repressed memory because I can't figure out why). Usually people just complain or want to debate about which one gets used. Some like jQuery, some like Prototype, some like X, Y and Z.

    SWFUpload doesn't do much DOM interaction and adding a library doesn't gain us much and adds a bit to the overall package size. Plus it makes us dependent on that library. Someone will start complaining that we aren't on version a.b.c yet.

    (I'll strategically leave out the benefits of using a library now ;) )

    I've been careful to keep SWFUpload in its own namespace so there aren't any conflicts with anyones libraries.

    Those libraries are great for UI stuff and SWFUpload is a good match because of it's hands-off approach to the UI.

    I guess in the end the great thing about having the source and a open license is that we can do what we want.

    ReplyDelete