« DataGrid Row Colors | Main | IFBIN is now FREE!! »
Uploader
| By Rich Tretola | July 31, 2006 | |
| 5,352 views |
Although this has been a part of Flash 8 previously, one of the coolest new features of Flex 2 is the ability to upload images and files. Here is a quick little component that allows set the max file size allowed, set the types of files allowed, automatically show the upload progress, and then display the image when the upload is completed. The syntax is simple:
<eFlexComponents:Uploader uploadButtonLabel=”Browse for New Image”
uploadToURL=”http://www.yourdomain.com/uploads/uploader.cfm”
imagesFilter=”*.jpg;*.gif;*.png”
displayNewImage=”true”
displayImagePath=”http://www.yourdomain.coms/uploads”
maxUploadSize=”100000″/>
Here is a ColdFusion (uploader.cfm) sample script to catch the file:
<cffile action=”upload” filefield=”Filedata” destination=”#ExpandPath(‘./’)#” nameconflict=”OVERWRITE” />
Right Click on application to view & download Source Code.
Topics: Components, Flex 2, Tutorials | 6 Comments »










May 18th, 2007 at 9:50 am
does not work at all.
io eror, bubbled s= faLSE, error #2038, event phase 2
Reply to this comment
May 18th, 2007 at 9:58 am
Yeah, sorry. I moved to a php based blog and the CF server is no longer there to accept the upload. You can download the source and run it on your own machine.
Reply to this comment
June 12th, 2007 at 3:44 pm
If I have this component inside form.mxml, how do I reference the uploaded fileName? I want to send the fileName to the database. fileName lives in Uploader.mxml and my RemoteObject lives in form.mxml. I’d appreciate any help.
Thanks,
Don Kerr
Reply to this comment
June 26th, 2007 at 10:57 am
first and foremost – we are using your uploader in production (or will be using) and I sincerely appreciate the time you have put into it. I am uploading correctly to a form – but I am having trouble understanding how I can add additional parameters to the upload. I know it posts to a form, but I need to also post username, password, title (string), and description (string). If you can quickly tell me the way in which I can add those to the post array, I would be grateful…
I am going to spend a few hours on it, If I figure it out first, I’ll post back my findings…
Reply to this comment
June 26th, 2007 at 1:28 pm
You will need to pass the additional arguments in a separate call as the Flex upload functionality only passes the image by itself.
Reply to this comment
February 19th, 2008 at 11:36 pm
Hi, great to read your flex apps, publish some tree view secrets if you can, I just drop a response to natan king, if someone else wonder at this late time.. you can send vars with the URL query string.. http://aaa.com/my.php?var=x&far=y
Reply to this comment