Flash File Uploader

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.”

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….
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.
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!!
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.
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.
July 26th, 2007 at 8:32 am
David, make sure you have the new version of the uploader installed.
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
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.
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
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.
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.
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/
August 20th, 2007 at 10:03 am
Thank you very much Don :D
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!
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.
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!
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.
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!