58 Replies to “Flash File Uploader (Updated)

  1. I could really use your help with a project that I think you’ll really like. I’ve been seeking someone who works with flash, php, and mySQL, but it’s tough to find someone that seems to have your combination of skills. Is it possible that you could contact me in reference to this.

  2. Hi Don,
    I really need your help in terms of expanding this script. Is there some way to contact you? I am more than willing to pay for your time. thanks!

  3. Andrew, I sent you a note offline. Edwin, am I correct in assuming that you’d like an HTML File field with javascript passing the file location to the Flash File Uploader?

  4. Hallo, I agree with them below –

    “I love Flash’s upload. It’s so much better than the extremely crap HTML upload.”

    I only want (or wonder) if it possibble to higher the upload limit from NOW about 12 mb – to let say atleast 250 mb – to the server – blocket.be – I offer FREE trade ad world wide – so I would be pleased if you can help me out – so far what I KNOW the fastes uploder on the world net – I try about 50+ and your Flash’s upload works great; to se it in action please visit;: http://www.blocket.be/flashupload/

    also one off the easy to install…

    Great work and many thank’s – it’s is a mysterium how people make this coded FREE TOOLS for us that not know anything!´

    Ciao,

    / Roman

  5. You’ll probably need to adjust the MAXs and TIMEs if you want to increase upload sizes:

    max_execution_time (in seconds)
    max_input_time (in seconds)
    memory_limit (in mb)
    post_max_size (in mb)
    upload_max_filesize (in mb)

    also, in the uploader HTML/PHP file, you’ll see the following SWFObject Variable:

    fo.addVariable("limit", "100");

    This means the overall limit of the flash file uploader is 100mb. You can increase it as necessary, but it should be the same as the server variable.

  6. I probably should have mentioned that those directives are to be updated in php.ini by your host or network administrator.

  7. Hi Don,

    Thanks for your work !

    I have only one problem… It’s with $_SESSION and Flash…
    I would like to upload files in the directory of the user who is uploading, and this directory is like $_SESSION[‘dir’] = “/files/”.$name_of_member;

    The problem is that Flash doesn’t like $_SESSION, it skip it.

    So I try to do that :

    var fo = new SWFObject(“uploader.swf?ul=100”, “flash_uploader”, “435”, “40”, 8, “#FFFFFF”, true);
    fo.addParam(“allowScriptAccess”, “sameDomain”);
    fo.addParam(“quality”, “high”);
    fo.addParam(“scale”, “noscale”);
    fo.addVariable(“to”, “upload.php?SESSID=”);
    fo.addVariable(“limit”, “100”);
    fo.addVariable(“types”, “video|text|pdf|image|audio”);
    fo.write(“flashcontent”);

    And at the beggining of upload.php :

  8. Code doesn’t work.. :

    var fo = new SWFObject(“uploader.swf?ul=100”, “flash_uploader”, “435”, “40”, 8, “#FFFFFF”, true);
    fo.addParam(“allowScriptAccess”, “sameDomain”);
    fo.addParam(“quality”, “high”);
    fo.addParam(“scale”, “noscale”);
    fo.addVariable(“to”, “upload.php?SESSID=<?php echo $_COOKIE[‘PHPSESSID’]; ?>”);
    fo.addVariable(“limit”, “100”);
    fo.addVariable(“types”, “video|text|pdf|image|audio”);
    fo.write(“flashcontent”);

    And at the beggining of upload.php :
    <?php
    session_id($_GET[‘SESSID’]); if( !isset($_SESSION) ) session_start();

    to have :
    $filepath = getcwd().”/files/”.$_SESSION[‘dir’];

  9. Hi Guillaume, You’ll need to add an additional variable to the index.php file to pass the path to the flash, like this:

    fo.addVariable("path", "");

    Then, the Flash should pass the user path to the upload.php script with something like this:

    item.upload("upload.php?d=true&type="+extension+"&name="+escape(item.name)+"&size="+item.size+"&ft="+exts+"&path="+_root.path);

    And you can modify the upload.php file to know where to store your file:

    move_uploaded_file($_FILES['Filedata']['tmp_name'], FILE_PATH . $_GET[‘path’] . “/” . _newfilename_ );

    Should work like a charm. If you’re still having problems let me know and I’ll send you an address to send the files so I can take a look.

  10. Absolutely. If you modify the Flash file to include other form elements, simply pass it to the PHP script to store. If you need help, just reply and I’ll send you my email.

  11. Hi Don, this is a very cool application you have built. I would like to change the file types to be uploaded. For example I added *.tif files to the images in the Action Script but when uploading a tif the webpage says that the file could not be uploaded. I also added my own case for compressed files:

    case “package” :
    var packageTypes:Object = new Object();
    packageTypes.description = “Package Files (*.zip, *.sit, *.sitx, *.tar)”;
    packageTypes.extension = “*.zip;*.sit;*.sitx;*.tar”;
    allTypes.push(packageTypes);
    exts.push(“zip”, “sit”, “sit”, “tar”);
    break;

    I can select the files in the open dialog box and the upload seems to go through but then returns: Error: The file could not be uploaded.

    Is there any trick to adding files types? Does ity have to do with the getid3? Thanks for your help. Dan

  12. Hi again, I guess my changes worked perfectly, I just needed to update my php.ini file. 🙂 Should have checked that first before posting my last post.

    I do have another question though. My server does not have GD enabled. I could rebuild PHP but I like to you ImageMagick anyway. Is there any easy way to turn off thumbnail creation so that I don’t get an error message after uploading a jpeg? Please let me know if it is easy.

    Maybe a future release could also use imagemagick.

    Thanks again for your great app!

  13. To disable thumbnailing:

    comment out :

    /*
    if(!file_exists(getcwd()."/files/".$_GET['cx']."/.s/$file") &&
    array_key_exists(strtolower(substr($file,-3)),$imgtypes))
    {
    $srcf = getcwd()."/files/".$_GET['cx']."/$file";
    $dstf = getcwd()."/files/".$_GET['cx']."/.s/$file";
    $type = $imgtypes[strtolower(substr($file,-3))];
    mcSaveImages(120,90,$srcf,$dstf,15,$type);
    }
    */

    later, in the script, $showthumbs allows them to be seen.
    If you’re not using this feature,hide the switch table:

    <table style='display:none;'><tr>
    <td><input type='checkbox' name='thm' id="thm" onclick="javascript:thumbs();" <? echo($showthumbs ? "CHECKED" : ""); ?>></td> <td colspan="3"><p>Details?</p></td> </tr> </table>

  14. How do I change file size limit? My download did not have instructions as stated. Please help.

  15. There are two places where the file size limit is determined, for two different purposes. Update the Flash Variable in the embedding page to limit uploaded files beyond what PHP is limiting.

    example:
    // Limit to 100M
    fo.addVariable(”limit”, “100?);

    The second place is in your PHP settings on the server. If you want to upload large files, and have set your FlashVar to the above, and notice that files are still timing out, it’s probably because PHP or Apache are limiting the size of files that can be uploaded.

  16. There are two places where the file size limit is determined, for two different purposes. Update the Flash Variable in the embedding page to limit uploaded files beyond what PHP is limiting.

    example:
    // Limit to 100M
    fo.addVariable("limit", "100");

    The second place is in your PHP settings on the server. If you want to upload large files, and have set your FlashVar to the above, and notice that files are still timing out, it’s probably because PHP or Apache are limiting the size of files that can be uploaded.

  17. People have asked me a number of times about adding compressed packages to the Flash File Uploader. It’s quite simple on the Flash side, but you’ll need to add logic for extracting and parsing the package on the server (using PHP). Here’s how you update the Flash:


    case "package" :
    var pkgTypes:Object = new Object();
    pkgTypes.description = "Package Files (*.gz, *.rar, *.sit, *.tar, *.zip)";
    pkgTypes.extension = "*.gz;*.rar;*.sit;*.tar;*.zip";
    allTypes.push(pkgTypes);
    exts.push("gz","rar","sit","tar","zip");
    break;

    You’ll also want to update the embedded page to include packages as part of the allowed file types:

    fo.addVariable("types", "video|text|pdf|image|audio|package");

  18. Thanks Don, your uploader is the best of all flash uploaders that I tried. This one is just great. I am really glad for this one. It helped a lot.

    Keep doing great job, i love you ;D

  19. I can not find the embedding file. I am a flash novice, but am great at image maps and web graphics. Can you help me a little further on adding zip files and the uploader limits? Where do I find the embedding file and how to I add the case, in the getid3 file? By the way, your uploader is the best by far out there!

  20. Sorry, Jennifer. I should’ve been more clear. There are a ton of words we used to use freely in the design world that have become muddled with homonymns. The embedded page is the index.php page where the flash is embedded. Though it’s not really embedded because I recommend swfobject over <embed> tags. And if I say “index” page, people assume the “index” page is the upload.php because that is the one that indexes.

    Anyway, you can change the flash variables in the index.php page. scroll up and read where it says:

    <fo.addparam ... >

  21. Hey Hey Don,
    Great file uploader.
    I am trying to use the “to” parameter as described:
    fo.addVariable(“to”, “/submit”);

    but it seems like the upload.php is still hardcoded in the SWF.
    I do not have Flash, so I can’t really edit the FLA.

  22. Hey Don,

    I am having a problem uploading video and audio files. I changed the size limit on php.ini and increased it in the php file. I keep getting this error…

    Error:
    The file could not be uploaded.

    FILE: 6.mp3
    TYPE: .mp3
    SIZE: 6185112
    ALLOWED: yes

    I have it selected as a file type in my code. Can you help me please? thanks
    http://thefutureisus.com/flashupload/index.php

  23. Thanks Don! This is exactly what I was looking for… a slick light weight file upload progress bar that bypassed the browser speed limit without using java and without tons of extra junk I don\’t need that\’s easily integrated into existing layouts.

  24. Hi there,
    Thank you again for your help.
    I am still having trouble adding the zip option to the uploader. I changed the flash code and index page, but have had no luck.
    Thank you again for making such a great uploader!

  25. Alon, Send me your email address and I’ll send you a modified Flash Uploader FLA with your submit script hardcoded. Otherwise, you’ll need to find someone with flash to work on it with you.

    Youngfonz, I tried your script and everything seemed to work fine for me.

    Jonathan, glad you like it!

    Jennifer, send me an email and we’ll figure it out together.

  26. Don

    this is the best script/flash file i have fond anywhere.. and i thiank you for your kindness in sharing.

    i have one question that i hope you can help with
    being a complete novice in scripting, i wouldnt know where to start.

    im looking to have this form on a central site – and upload it to a defined/dynamic set of folders. im basically going to be creating a cheezy client base where people can log in and view files we have uploaded to our server.

    but i want to be able to create some of these folders on the fly by inputting the name and have the file ploaded tothe new directory..

    am i making sence? any ideas?

  27. Hi Reverend, I think the solution is the same as what Alon (above) needs…which would be to not have a hard-coded output directory. Where Alon should/could probably have the directory name passed through FlashVars, you’d probably need an additional field in the uploader where a user could enter the directory name. I’d caution against doing this, naturally, because it opens up issues with directory name validation, overwriting, etc.

    Perhaps I can quickly put together a Flash File Uploader where the directory is pulled from FlashVars and this could help the two of you. Alon, who doesn’t have flash, can modify the save location. And Reverend, you can use PHP to dynamically change that FlashVars to whatever you want.

    Let me know…

  28. ahhh
    i get it.

    i guess i was looking for a dynamic input where on http://www.mydomain.com/upload/ would be another text box where I could type in my own…

    i assume this could be done with a bit more of coding – to automatically generate the string?

  29. even to take it one further – to have the directory list be put into a pulldown – with the option to create new – and name it accordingly…

    similar to the way myspace handles photo albums…

    i assume that gets into database stuff?

    i never knew how green i was.. hehe

  30. Sure. As it is now, the PHP grabs the GET string or uses the default and passes it the Flash, which, in turn, returns it to the upload.php script. You could skip the first pass by adding an input text box in the uploader FLA that passes that variable directly to the upload.php script. Make sure, if you do this, though, you add form validation to ensure their directory name doesn’t have slashes or weird characters.

  31. Well, you wouldn’t really need a database, Reverend. You could have the PHP just pass the list of directories as a SWFObject Flash Variable and the Flash could create the dropdown elements from the FlashVar array with the “Add New” option automatically appended to the bottom. Adding a database would probably be more hassle than it’s worth as you’d need to update the DB each time you wanted to add a new directory. BTW, I wouldn’t say you’re “green”, as you know all the theory behind the code…and that’s equally important to knowing the code itself. Good luck.

  32. looks like i have some work ahead of me!
    as soon as i get my head out from my 9-5 im going to see what i can come up with. if i get anything of substance.. ill be sure to forward it to you – and you can post it

    ill keep chek in to see whats new as well
    thanks again for your help

  33. Hello!
    I was wondering if you did any special server configuration, so that the 404 error on Mac os x does not apperar. When I install the uploader, it always returns a 404 Error when the upload has finished. But when I try it on your site era404 it works perfect. Did you tune anything there. Do I have to configure something special on the server? (gentoo)

    Thanks for your sugestions.
    Guido

  34. Hi Guido, The uploader will produce 404 errors if the file was restricted after it was copied to the server. Sometimes this happens if the file size is greater than the max filesize, memory or post max settings of the server. The uploader will attempt to upload the file to a temporary folder and the PHP will then copy the file over to your desired folder (see information about custom directories). If PHP recognizes that the file is too large, or the server settings are too low/small, the file won’t be able to be copied to the custom directory. Check your php.ini file or try uploading an extremely small file to see if this is the issue you’re experiencing. It may also have something to do with the permissions PHP needs to copy the file to the new location. If your uploaded file is not being moved (due to size or permission constraints), you’ll get a 404. Hope this helps. -Don

  35. Hi,
    I would like to ask your permission to use the flash uploader on a site!
    Best wishes
    Brian

  36. hi don… i’ve this problem… when upload a file… from 35mb onwards… finished the upload appear this message:

    ERROR:
    The file could not be uploaded!
    Filesize (36063694) is larger than permitted by this host (31457280).

    FILE: we.mp3
    TYPE: .mp3
    SIZE: 36063694
    ALLOWED: yes

    i’ve modified the string fo.addVariable
    in fo.addVariable(“limit”, “10000”);

    but there is always this problem… why?

  37. It appears that your host is limiting filesize on uploads submit a support ticket to them to ask if they can increase it. Otherwise, you may need to inform your users that uploads cannot exceed 31MB or switch hosts.

  38. Hi, I am trying to change the hardcoded file types to add .dwg, .tif and a few others, and reorder the filetype selection.

    But, I am not a flash programmer so I have no idea how to do this.

    Can you tell me step by step, assuming I know nothing, how to change the file type handling, or even how to get rid of the hardcoded file type limitations alltogether.

    Thanks,

    V.

  39. Hi Don,

    LOVE the uploader. I’ve been battling poor AJAX upload scripts for years. I have a client that requires 500 MB+ uploads (and it has to be browser-based) and I’m going to try your flash file on it. If it works, I’m going to send you some money. So far (with smaller uploads) it’s worked great.

  40. Hi Jamon, Thank you for the kind words. Don’t worry about sending money — the uploader is free to use. I’m glad you’ve found it helpful.

    Don

  41. I”m not worried about sending money–I’m just going to do it. 😉 I have the uploader working 100% for 2 to 4 MB files right now, so now it’s time to upload a 220MB+ video file and see if it works. If not, can I email you? My email is my first name at my website.

  42. You’ll probably need to adjust the MAXs and TIMEs if you want to increase upload sizes:

    max_execution_time (in seconds)
    max_input_time (in seconds)
    memory_limit (in mb)
    post_max_size (in mb)
    upload_max_filesize (in mb)

    If your server supports uploads larger than 220MB, you should be fine. Check with the configuration settings. If you run into issues, I’d be happy to look into it for you, when I get a moment.

Comments are closed.