13
Nov
2009

new multiple file uploader with preview

Hi friends,

in the past months i’ve been busy with work & life, so my time on this project was limited.
i managed to do some things , but i’m not so satisfied from the final result, thats why it took long time to upload the version.

new in this version -

xml file for configuration :

<?xml version=”1.0″ encoding=”utf-8″ ?>
<uploaderSettings lang=”en”>
<maxFilesForUpload>5</maxFilesForUpload>
<autoPlayMp3>1</autoPlayMp3>
<language id=”en”>
<browse>Browse</browse>
<choose>Choose file to upload :</choose>
<remove>Remove</remove>
<upload>Upload</upload>
<uploading>Uploading ..</uploading>
<uploadFailed>Upload Failed.</uploadFailed>
<encoding>Encoding ..</encoding>
<upload_deny_error_is_encoding>Wait for encoding to end.</upload_deny_error_is_encoding>
<uploadDenyErrorMaxUploadExceeded>Max number of files uploaded.</uploadDenyErrorMaxUploadExceeded>
<rotate>Rotate</rotate>
<no_files_to_upload>No files to upload..</no_files_to_upload>
</language>
<sizes>
<size default=”false” name=”640×480″ width=”640″ height=”480″></size>
<size default=”true” name=”1024×768″ width=”1024″ height=”768″></size>
</sizes>
</uploaderSettings>

it’s kinda self explainable..

i’m using zend amf for the uploading progress – so you can see each file upload progress (with this i’m not so pleased as each connection takes few milliseconds which causes upload to be delayed a bit)

you can add more languages to the config file (or submit a language in the comments and i’ll add it to the config file)

i really think of dumping the amf + progress and return to the old upload method – waiting for your comments on that.

another improvement – you can specify the height and the flash will stretch to the desired height (means more then 3 file strips)
from now you can upload mp3 files (with client side preview of the songs)

watch the demo, or download the pack here (multiple file uploader)

let me know if you want to be a part of the development for this component, i am thinking of uploading it to an svn server for ppl to contribute.

Ady.

http://www.adylevy.com/wp-content/plugins/sociofluid/images/digg_32.png http://www.adylevy.com/wp-content/plugins/sociofluid/images/stumbleupon_32.png http://www.adylevy.com/wp-content/plugins/sociofluid/images/delicious_32.png http://www.adylevy.com/wp-content/plugins/sociofluid/images/furl_32.png http://www.adylevy.com/wp-content/plugins/sociofluid/images/technorati_32.png http://www.adylevy.com/wp-content/plugins/sociofluid/images/google_32.png http://www.adylevy.com/wp-content/plugins/sociofluid/images/myspace_32.png http://www.adylevy.com/wp-content/plugins/sociofluid/images/facebook_32.png http://www.adylevy.com/wp-content/plugins/sociofluid/images/yahoobuzz_32.png http://www.adylevy.com/wp-content/plugins/sociofluid/images/twitter_32.png http://www.adylevy.com/wp-content/plugins/sociofluid/images/meneame_32.png
Posted in Flash Demos, as3

44 comments »

  1. Vadim said,
    November 14, 2009 @ 9:52 pm

    Hi Ady,
    Thanks for the new release and new configuration features in it. Here are some comments from me.

    First, about the progress which is shown when a user selects an image. Perhaps it is a progress of a JPEG coversion. I think it would be good to show a text “Converting…” as a status for user to know that the uploader is doing.
    I think there is no big trouble in waiting for some millisecs for AMF connection. Here are some suggestions: it is possible to trick user showing some small progress instead of showing an empty progress bar during the connection phase. I am not familiar with AMF, but perhaps it is possible to start a new connection at the same time as the previous one is still active, so the delay would be only for the first upload.

    About picture sizes – they exist in the configuration file, but I couldn’t find them in the uploader itself. Very strange:)

    About the configuration file – perhaps it would be more nice to name all the tags in camelcase, not with underscores, but it’s just a remark.

    About a community – I think this is a good idea, Google Code it the right place for this project.

    Br,

    Vadim

  2. nicostro said,
    November 22, 2009 @ 2:06 pm

    Dear Ady,
    I’ve found your site after a very long search on the web about multiple files upload.
    Now, I think I’ve found what I need. You made a very good work!

    The only problem is that the files are not uploading with this last version. I’ve tried with the previous release, and all seems to go.

    Any suggestion? Than you!

    (if you want, I can make italian translation of your work)

  3. nicostro said,
    November 23, 2009 @ 3:56 pm

    Ok, I solved the problem manually changing the global var “path” in the class file ‘main.as’.
    For some unknown reason, the flashvar passed in the page ‘index.php’, is not read by ‘imgUpload.swf’.

    (P.S.: I’ve just translated the button and info’s text in italian)

  4. admin said,
    November 23, 2009 @ 11:52 pm

    @nicostro -
    glad to hear its working as expected for you.
    i hope you used the xml file for the translation.
    you can post the script here and i’ll add it to the global xml file sometime.

    @vadim –
    sorry for not answering for a long time, i’m deadly busy lately. thanks for your comments & support,
    people like you gives me strength to go on and improve the project!
    i know – some of the options in the configuration file are not working, it will work sometime in the near (far) future.

  5. nicostro said,
    November 24, 2009 @ 12:01 am

    Here is the italian translation for the xml file:

    Sfoglia..
    Scegli file da caricare: :
    Rimuovi
    Carica
    Caricamento in corso ..
    Caricamento fallito!
    Codifica ..
    Attendere la fine della codifica!
    Numero massimo di foto caricato.
    Ruota
    Nessun file da caricare!..

  6. nicostro said,
    November 24, 2009 @ 12:42 am

    Sorry, but in the previous comment the xml tags disapperead on plublication..

    Ok, now I have another important question:
    I don’t understand how the photos are uploaded to the folder ‘uploads’.
    I was thinking that it happens through the file ‘receiveFile.php’. I’ve tried to modify it to point to another folder, however files go always in the ‘uploads’ folder! I’ve also tried to delete this file, and all works in the same way…

    Then I’ve searched everywhere beetween “.as” files, without finding anything..
    Where’s the ‘trick’? ;)

    Thank You!

  7. Kevin D said,
    November 24, 2009 @ 6:46 am

    Ady, I’ve been looking for this all day. Thank you.

    @nicostro: Ady can confirm, but I think there is a path in “server.php” to uploads folder. Take a look “\production\zendAmf\server.php”. I’ll install and try it shortly.

    Thanks Again Ady!
    -K

  8. nicostro said,
    November 24, 2009 @ 6:09 pm

    Great!

    It works! Thank You very much Kevin D!
    Now, I don’t understand the role of “receive.php”…

    About the problem I had with the path var, it was because in the passed flashvar there were too much slashes.

    In “index.php”, in the line:
    $path.=”/”.$info['basename'];

    I have removed “/”. and all works fine!
    $path.=$info['basename'];

    Thanks to all so much again!

  9. nicostro said,
    November 24, 2009 @ 9:28 pm

    Ok, now last step is how to put the uploaded photos into a MySql database.
    Where is the right point to put the query? I’ve tried in ’server.php’ without success..

  10. admin said,
    November 25, 2009 @ 12:32 pm

    it should be in the server.php file,
    but notice that this file being called for each file 5 times or so with different chunks. you should put the file in the db after the last chunk.

  11. nicostro said,
    November 25, 2009 @ 1:22 pm

    I can’t understand what is the ‘last chunk’..
    You know, to insert data into the db, I have to put the query “INSERT INTO..” and so on, for each photo (and open a db connection, first).
    I’ve tried to write that in “class UploadHelper”, but it doesn’t work..
    I don’t know how to do, because inserting data in db is fundamental for me..

  12. Alex said,
    November 26, 2009 @ 5:01 am

    Hello! Thanks for this great project! I’m now trying to test it, and i have the next problem.

    I need to pass a GET parameter(id) to server.php, so that i could make a folder to save images, depending on that parameter. Tried to declare a QueryString variable in amfUploadHelper.as, and modify this line(uploadConnection.connect(globals.path+”/zendamf/server.php”+queryVar.paramenters.id);) but then, compiling, i got many errors, almost all of them have nothing to do with queryString.-(

    What am I doing wrong?-) Thank you very much!

  13. Alex said,
    November 26, 2009 @ 5:05 am

    uploadConnection.connect(globals.path+”/zendamf/server.php?id=”+queryVar.paramenters.id);

  14. Alex said,
    November 26, 2009 @ 3:32 pm

    I installed cs4, and everything is good! Except for that i cant pass parameters in a right way-(( Sorry!

  15. nicostro said,
    November 26, 2009 @ 3:57 pm

    I still haven’t found what I’m looking for… (there’s a song which says this..)

    I’m trying everything whit chunks, offsets, and so on.. in “server.php” and also in “amfUploadHelper.as” to put info into database.. The result is only an headache..

    When something goes in the db, I get a lot of errors and the upload stops after the first image.

    Help please!

  16. Alex said,
    November 26, 2009 @ 4:08 pm

    function checkUsername():void
    {
    var value:String;
    var obj:Object=LoaderInfo(root.loaderInfo).parameters;
    for (value in obj)
    {
    user_id=String(obj[value]);
    trace(user_id);
    }
    }

    and i get an error that says: “1120: Access of undefined property root.”; thnx

  17. Dave said,
    November 27, 2009 @ 11:23 pm

    Hi Ady! I found that, after uploading images with ur tool, i’t not possible to resize them using gd2 php library.

    Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file in Z:\home\test1.ru\www\swf\production\thumb.php on line 19

    Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: ‘foto/126/4.jpg’ is not a valid JPEG file in Z:\home\test1.ru\www\swf\production\thumb.php on line 19

    Warning: imagesx(): supplied argument is not a valid Image resource in Z:\home\test1.ru\www\swf\production\thumb.php on line 20

    Warning: imagesy(): supplied argument is not a valid Image resource in Z:\home\test1.ru\www\swf\production\thumb.php on line 21

    Warning: imagecopyresized(): supplied argument is not a valid Image resource in Z:\home\test1.ru\www\swf\production\thumb.php on line 32

    Those are the errors.-((

  18. admin said,
    November 28, 2009 @ 10:37 am

    ohh – un nice !
    i will check it out soon, and let you know my result.

  19. David said,
    November 29, 2009 @ 11:59 pm

    Thank you, i guess something wrong with jpeg headers!

  20. David said,
    November 30, 2009 @ 1:04 am

    Also, i’m getting a 500 internal error-( But that seems to be a server problem.
    “SecFilterEngine Off
    SecFilterScanPOST Off” didnt help!

  21. FritsK said,
    November 30, 2009 @ 4:51 pm

    Damn.. got a problem! But first: I succesfully linked the whole thing to a database.

    Just INSERT, without any echo or HTML output, the filename into a database after the end of the WHILE in server.php (found in: zendAmf-folder)
    So:
    if ($currentOffset==0) {

    WHILE {

    }

    }

    But I ran into another problem: I can’t seem to upload any images to my server, even when the uploads-folder and all content is set to 777. I thought it might be my tweaked index.php or server.php, but even when I’m trying to upload JPG’s with imgupload out-of-the-(zip)box, nothing happens. Encoding works (as far as I know: the blue bar gets 100% filled), but when I push the ‘upload’-button nothing really happens.

    Hopefully someone else can help me with this problem!

    Greetings,
    FritsK

  22. FritsK said,
    November 30, 2009 @ 4:53 pm

    Something went wrong in de post above, text was removed.

    if ($currentOffset==0) {
    blabla
    WHILE {
    blabla
    }
    INSERT INTO DB HERE
    }

  23. nicostro said,
    November 30, 2009 @ 11:18 pm

    Thank you FritsK for your interest, but I think that the solution you found to insert data into a database, is the cause of the problem!
    I’ve tried in every way to put “insert” query between the lines in server.php, but I’ve got always the same problem which you also have..

    I’m searching for another solution but I don’t know how to do!

  24. nicostro said,
    December 1, 2009 @ 1:04 am

    For the upload problem with “imgupload out-of-the-(zip)box”, take a look to my fifth post where I say that there were too many slashes in the “path” flashvar passed by “index.php”. Maybe it could solve your problem.

  25. FritsK said,
    December 1, 2009 @ 12:00 pm

    Hi nicostro,

    It can’t be the problem, since I’ve uploaded the original Multiple file uploader too, and even without connection to the database it doesn’t upload. So I thought that maybe the server was the cause of the problem.. But it isn’t, since a second server has the same problem. So far it only works well on my localhost using xAmpp (with database insert!).

    Already echo’ed the $path value, it always returns the right result i.m.o.: “http:///photoupload/production”. No ‘/’ missing or one or several too much.

    But, in your second post (http://www.adylevy.com/index.php/2009/11/13/new-multiple-file-uploader-with-preview/#comment-1051), you’ve changed the main.as right? The only thing you did is to hard-code the URL in the main.as, so it isn’t dynamically parsed from the index.php to Flash?

  26. FritsK said,
    December 1, 2009 @ 12:44 pm

    This site automatically removes everything in triangular brackets.. So the echo’ed $path value mentioned above: “http:///photoupload/production”, should be: “http://www.servername.com/photoupload/production”, sorry for that.

  27. FritsK said,
    December 1, 2009 @ 12:58 pm

    Sorry for the three-replies-in-a-row..

    I’ve tried out the older version (v201, found at http://www.adylevy.com/index.php/2009/07/22/multiple-files-uploader-with-preview-on-client-side/ ) and it works like a charm.. But client-side resize was one of the main reasons why I picked this imgupload version above the old one..

  28. Adam said,
    December 5, 2009 @ 11:51 am

    It’s very good but still. When I input more images at once, flash script will try to resize them in more threads. CPU load goes to the top and computer is almost dead. Better solution will by resize/manipulate pictures one by one.

  29. Yury said,
    December 8, 2009 @ 4:30 pm

    Hello, Ady!

    Thank you very much for this great solution.
    I have some questions to you. I’m trying to implement the old one version(201) and:

    1. How about some other file formats support? Some people use vector graphics… xmmm..
    2. I don’t want to use AsyncJpegEncoder for uploaded files(Want to upload them “as is”) — how could i escape it?

    Regards, Yury.

  30. Slim said,
    December 9, 2009 @ 6:09 am

    hello
    first wanted to say greaat greeat work ive been searching for weeks for such a good tool ..

    then i was wondering if anyone can help me i am having some problem with the installation..
    I am kinda noobi
    so i searched arround and changed the path in index.php and server.php
    after installing a flash debbuger i found out that there was a problem i get this error ..

    Error #2044: NetStatusEvent non pris en charge : level=error, code=NetConnection.Call.Failed
    at Classes.file::amfUploadHelper/get _connection()[Z:\imgUpload\fla\Classes\file\amfUploadHelper.as:62]
    at Classes.file::amfUploadHelper/uploadNextChunk()[Z:\imgUpload\fla\Classes\file\amfUploadHelper.as:83]
    at Classes.file::amfUploadHelper/sendFile()[Z:\imgUpload\fla\Classes\file\amfUploadHelper.as:106]
    at main/uploadNextFile()[Z:\imgUpload\fla\main.as:185]
    at main/_handleUploadEvent()[Z:\imgUpload\fla\main.as:235]

    can anyone help please? ?
    what to do ??
    ( i dont have a folder named imgUpload .. but i tried renaming the hole folder to imgUpload and didnt work.. any clues ?? )

    thanks anyway
    slim

  31. Didier said,
    December 14, 2009 @ 2:26 pm

    Hello Ady,

    I have a real estate classifieds website (FSBO). Could it be possible for you to implement your multiple resizer and uploader files onto my website, and for what price ?
    Thanks to reply me on my email address.
    Didier

  32. Jb said,
    January 5, 2010 @ 12:05 pm

    Thank you for this really useful component.

    Unfortunately, I have an issue with it… My website has specific URL’s for downloading contents, then I need to specify to the component which URL to use for upload… (I use URL rewriting…)

    Would it be possible to add that parameter into the XML ? (replacing the “receiveFile.php” by another URL like “http://www.mywebsite.com/testsite/image/upload/” )

    Thanks for your help ;)

  33. Jb said,
    January 5, 2010 @ 4:24 pm

    And maybe also adding the background property to the XML…

    It would be perfect.

    Thanks a lot for this nice software, I hope you could make the script’s path an XML property in order to integrate it into my website.

  34. Cone said,
    January 5, 2010 @ 8:10 pm

    Hi Ady! Ur script works like a charm on localhost, but on web-server, the upload progress doesn’t start up, and files are not uploaded. What could be the problem?? Firebug shows no errors-(

  35. admin said,
    January 6, 2010 @ 10:29 am

    try checking the permissions on your web server.

  36. ZyBeR said,
    January 8, 2010 @ 12:41 am

    I’ve been testing this component for a while now, it works great. I used v2.01 up until today when I tested the new version.
    I really like that you have implemented the config.xml file, with that you solved the only problems I have seen.
    But i really don’t like the zend crap it’s using now, please remove that and go back to the clean and simple way it was before.
    Don’t fix what ain’t broken, this is a super nice little component, keep it that way.

    Thanks for good work, keep it up :)
    (if you drop me an email I can give you a link to the community where it’s implemented)

  37. Ferhat Ural said,
    January 9, 2010 @ 8:46 am

    For those who run into problems while uploading and using Linux as the web server :
    If your linux server is case sensitive as the others please change production/zendAmf to production/zendamf and the required file name in server.php to require_once(”library/Zend/Amf/Server.php”); S is in capital…

    By the way, after uploading, is it possible to refresh or redirect the page ?

  38. PaDalton said,
    January 13, 2010 @ 6:44 pm

    Nice work !!!

    I see you work with swfobjects,
    this is a very powerful application and
    i used it in one Project an now i have a Project
    where i like that your Project is very simple and
    have all i need and not more ;)

    Maby you can comment your code.

    I can do a german transation!

  39. Serg said,
    January 14, 2010 @ 6:41 pm

    Hi everyone!
    I think this is a great tool to use!!! Congratulations, Ady!!!
    But I’m having a problem with the latest version. When click “Upload”
    it says “Uploading..” and nothing happens… just sitting there.
    There is no problem running v2.01.
    Both versions are on a same web server, have same security setting.
    Can someone to point me in a right direction what I’m doing wrong?
    Thank you

  40. Alexander said,
    January 20, 2010 @ 2:28 am

    Hello. Thank you for this great work! It’s very cool!

    I have only one question: it’s possible set static max file size for processed image?
    If existing file size is smaller, than this max, we make standart processing. In case, if size larger, than max size – programm make fixed size, i.e. max_size-20 Kb. Is exist any parametr for this type (fixed size) processing?

    Thank you! =)

  41. Hilton said,
    January 24, 2010 @ 1:54 pm

    Hi All,

    First off, thumbs up to Ady for this valuable tool which seems to be getting better and better. I must however agree with some of the guys that you must not “over-accessorize”, instead stick to what works. Like many of the other guys, I also spent an age surfing the net for exactly this kind of solution. You’re onto something great, DO NOT stop!

    With my limited flash knowledge, I just know I am close to getting this to work, but am now throughly stuck:

    Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion
    at Classes.file::amfUploadHelper/get _connection()[Z:\imageupload\imgUploadv25\fla\Classes\file\amfUploadHelper.as:62]
    at Classes.file::amfUploadHelper/uploadNextChunk()[Z:\imageupload\imgUploadv25\fla\Classes\file\amfUploadHelper.as:83]
    at Classes.file::amfUploadHelper/sendFile()[Z:\imageupload\imgUploadv25\fla\Classes\file\amfUploadHelper.as:106]
    at main/uploadNextFile()[Z:\imageupload\imgUploadv25\fla\main.as:186]
    at main/_handleUploadEvent()[Z:\imageupload\imgUploadv25\fla\main.as:236]

    Here is the full error message. Can anyone give me some indication of what this is for, and thoughts on how to fix. Thanks in advance.

    Once I am better acquainted with this image uploader, I would love to contribute in any way I can.

  42. January 28, 2010 @ 5:37 pm

    i found the problem of Dave said at November 27, 2009…
    now php DG could load the image correctly.
    try to fix the code in amfUploadHelper.as around line 95,
    chunkLength = Math.ceil(btArray.length / NUM_OF_CHUNKS);

  43. santosh said,
    February 15, 2010 @ 8:49 am

    Hey Ady,
    First of all million of thanks for creating multiple uploader.I have downloaded it and I am trying to figure your code,so that I can understand it better.
    And you truly rock for giving such a resource which is indeed valuable.
    Great work mate.

  44. JProm said,
    February 26, 2010 @ 8:49 pm

    I’m having the same issue as Serg. The old version worked awesome but I couldn’t specify resize options. Now I’m trying the new version and it just sits at uploading..

Leave a Comment