Ever wanted to build an application that allows the user to upload multiple files? Well we all know it can't really be done unless you use either a Java Applet or Flash.
Doing a Google search turns up all manner of applications to do just that. But I want something simple, nothing more than a text box, a browse button, an upload button and a progress bar. Unfortunately my search turned up nothing, so I set about building my own using Flex 3.0.
It isn't anything special but you can:
1) Change the background color by tagging on a query string
2) Have a javascript function on the page that passes the urlyour upload page and any other parameters you want to pass along to the SWF.
3) Have a javascript call back function on upload complete
It provides the functionality I want and that is to upload multiple files, without any other unnecessary fancy bits, and requires minimal setup too.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="380" height="78">
<param name="movie" value="Uploader.swf">
<param name="quality" value="high">
<param name="wmode" value="opaque">
<embed src="Uploader.swf?BackgroundColor=ffffff" wmode="opaque" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="380" height="78" style="z-index:-100000 "></embed>
</object>
The Javascript functions:
<script language="javascript">
function getPath(){
return "upload.cfm?cfid=#cfid#&cftoken=#cftoken#&path=#uploadpath#"
}
function uploadComplete(){
//do something here after the upload
}
</script>
And finally a screenshot:
1)Before Upload:
2)After Upload:
If you would like a copy send me an email: gary[ at ]garyrgilbert[ dot ]com or you could click the download link at the bottom of this post.