• About
  • Verse
  • Code
  • Sketch
  • Pix
  • Blog
Donline: The Personal Blog of Don Citarella
« Save your Changes Amex Photo Magnets , »

Flash File Uploader

May 30th, 2007 by Don Code Examples, News

Uploader Screenshot

I was getting tired of upload scripts timing out in Flash and talked with Mike a little about creating an AJAX uploader. Unfortunately, AJAX has a difficult time updating a progress meter while an upload is running and it still cannot prevent browser requests from timing out on some servers. Granted, you still can use AJAX to do this and I’d recommend reading up on a number of online tutorials that offer solutions. However, up until the advent of Flash’s FileReference Object, programmers had to rely on server-side Perl scripts to manage these uploads and as Zeh so eloquently put it, “I love Flash’s upload. It’s so much better than the extremely crap HTML upload.”

>> Flash File Uploader

18 Responses to “Flash File Uploader”

  1. charles Says:
    May 31st, 2007 at 8:31 pm

    hey don…thanks so much for the tute…..i was looking for something exactly like this…..i’m having trouble with the swf showing up? the page is just all white……when you view the code it’s there, but no uploader…..any ideas? i have flash 9 plugin….would that be an issue? thx in advance….

  2. Don Says:
    June 1st, 2007 at 5:45 pm

    My pleasure. You might want to double-check the SWFObject to ensure it’s embedded correctly. Email me a link and I’d be happy to assist.

  3. Sean Says:
    July 19th, 2007 at 11:04 am

    hey don…Love the uploader…Just having an issue.
    Try to upload at mogills.com/index.php…not sure what else I need to do here to make the upload fully work. Any thoughts or hints? Thanks for all your generosity!!

  4. Don Says:
    July 20th, 2007 at 5:51 pm

    Access forbidden right now. Please let me know when it’s visible so that I can help you with troubleshooting this issue.

  5. David Bunting Says:
    July 25th, 2007 at 5:43 pm

    I love what iv seen of the uploader. I say what iv seen because i cant get it to upload anything.
    “type” is always empty.
    This is what i keep getting back
    “The file could not be uploaded.
    Filetype () not permitted.

    FILE: 23.jpg
    TYPE:
    SIZE: 74832
    ALLOWED: no”

    i checked the selected file properties and it doesnt display a file type either.

    dont know if it matters but im currently testing it localy on a mac, PHP 4.4.4 using both firefox 2.0.0.5 and the latest version of safari.

  6. Don Says:
    July 26th, 2007 at 8:32 am

    David, make sure you have the new version of the uploader installed.

  7. xian Says:
    August 13th, 2007 at 3:40 am

    hi don

    thanks for sharing! this uploader is cool, it actually works for me only with some concerns Id like to resolved

    1. there is a pop up alert on *some videos im trying to upload saying: “A script in this movie causing Adobe Player 9 to run slowly. If it continues to run, your computer may become unresponsive.” - Is there some configuration I should do to avoid this?

    2. I may want to up-size the default 8 MB upload file size to 30 MB. Where in index.php I could replace the value?

    Thanks for your support

  8. Don Says:
    August 13th, 2007 at 8:39 am

    Xian, with some browsers, you can suppress the pop-up by doing the following. In the site root add a .htaccess file containing the following lines:

    SecFilterEngine Off
    SecFilterScanPOST Off

    The pop-up doesn’t show for me until after about 40MB (1 minute).

    By default, my script has the Flash Variable of “limit” set to 100 (MB). You can change that to whatever you like, however, if you don’t have control over the upload limit on the server configuration, it won’t matter much. Contact your host to find out what the upload limit is.

  9. Pete Says:
    August 17th, 2007 at 6:08 am

    Thank you very much for your upload script :D.

    I add

    SecFilterEngine Off
    SecFilterScanPOST Off

    and it’s still show a popup alert. Please help advice

  10. Don Says:
    August 17th, 2007 at 8:23 am

    Pete, Unfortunately, this is tied in with the Flash Plug-In. So far, I’m unable to find a way around it, but I’ll keep looking. The pop-up doesn’t come until around 40M transfer for me. For most files, it won’t be seen at all. I’ll let you know when I have something…or if it’s possible.

  11. Pete Says:
    August 17th, 2007 at 8:51 am

    Don, I found some solution for this
    http://rockstardeveloper.com/articles/2007/04/22/flash-script-running-too-slowly

    It looks like a Flash action script code. Hope this help you to find out.

  12. Don Says:
    August 19th, 2007 at 6:26 pm

    Hey Pete, That link fixed it. Thanks! Simply replace:

    stop();

    (on the AS layer 1) with:

    _root.onEnterFrame = function() {
    if (this.getBytesLoaded() / this.getBytesTotal() > 0.99) {
    _root.onEnterFrame = function() {
    trace (”onEnterFrame called”);
    };
    }
    };

    Or just grab the new zip file, here:
    http://don.citarella.net/index.php/actionscript-examples/flash-file-uploader/

  13. Pete Says:
    August 20th, 2007 at 10:03 am

    Thank you very much Don :D

  14. Edwin Says:
    October 22nd, 2007 at 1:42 am

    Hi Don, how can I use javascript to do the upload action. I want to actually post the data to a PHP file. Thanks!

  15. Don Says:
    October 22nd, 2007 at 10:58 am

    I’m not certain I understand. The data is posted to a PHP file. Please explain what you need.

  16. Edwin Says:
    October 22nd, 2007 at 7:53 pm

    Sorry that my english is not so well. I have a html form to upload a video file, users need to input title, description and of course there is a file field. I want to use your great flash file uploader to replace the file field, how can I start the file uploading when users click the submit button (not the upload button in your uploader)? Thanks!

  17. Don Says:
    October 22nd, 2007 at 8:47 pm

    You can create a form on the HTML page and include a javascript that activates the Flash Upload once your variables have been set:

    function uploadMe(){
    	var upload_button = document.theForm.action_upload;
    	var upload_url = “http://www.yourdomain.com/your/upload/script/”;
    	up.SetVariable(”upload_to”, upload_url);
    	up.SetVariable(”ul”, “100?);
    	upload_button.disabled=’true’;
    	return false;
    }
    <form method=”post” enctype=”multipart/form-data” action=”http://www.yourdomain.com/
    - upload/page/” name=”theForm” id=”theForm” onSubmit=”return uploadMe();”>
    // Place form elements here.
    <input id=”upload_button” name=”action_upload” type=”submit” value=”Upload Video”>
    </form>
    

    In addition, you can use this function for form validation or passing the values of the form through the flash to your PHP script.
    Please let me know if this answers your questions.

  18. iCeR` Says:
    November 20th, 2007 at 3:56 pm

    Hi Don,

    Thank you so much for the uploader, yours seems like the only working one out there in terms of security settings etc.
    Just wondering if you could help me customise the flash uploader. Instead of using php to display the folder and image preview, are you able to help me customise the flash animation to show the user only the one uploaded image and when they scroll over it it shows a bigger version?
    need it for a client due this week :/ Thanks again!

Leave a Reply

  • Categories

    • Code Examples (12)
    • Illustrations (6)
    • Journal Entries (32)
    • News (124)
    • Photography (24)
    • Poetry (11)
    • Prose (5)
    • Sketches (8)
  • Archives

    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
    • April 2007
    • March 2007
    • February 2007
    • January 2007
    • December 2006
    • November 2006
    • October 2006
    • September 2006
    • July 2006
    • June 2006
    • April 2006
    • March 2006
    • January 2006
    • June 2005
    • April 2005
    • February 2005
    • September 2004
    • February 1999
    • January 1999
    • December 1997
  • Links

    • era//404 Creative Group, Inc.
    • SwissMiss
    • Fischler.org
    • Picture Calendar
    • My Flickr Page
    • My MySpace Link
    • My Friendster Page
    • My Faceparty Link
    • Citarella.net
    • Venice
    • Spain
    • France, Switzerland, Germany
    • England
    • Ireland
    • Fuse Number 8
    • My Facebook Page
    • My Maddened Mind
    • Prague
    • Vienna
  • Recent Comments:

    • Don: Hi Narsil, Sorry I didn’t see this sooner, I would’ve been happy to send you the modified FLA. Glad...
    • Narsil: Hey Don, I went ahead and downloaded the demo of Flash CS3 and made the necessary edit. Thanks!! I love this...
    • Narsil: Don, Regarding the “All Files” capable upload.. The way I am going to be implementing the Flash...
    • Don: Hi Narsil, Glad you got it fixed. A 403 error (forbidden) means you’re attempting to perform a task that...
    • Narsil: Hey Don! I got my previously problem fixed. I really am not sure why it wasn’t working, but it is now....

Copyright © 2007 [d]online. All Rights Reserved.
Entries (RSS), Comments (RSS). Valid XHTML, CSS. Proudly powered by WordPress