[thelist] Uploading multiple files using cold fusion <cffile> + javascript

Aaron Johnson lists at cephas.net
Mon Jan 20 10:20:01 CST 2003


Hi Stevenson,


> in javascript, is it possible to form a comma delimited string with files
> that can be uploaded with a cold fusion template.
> If yes, can someone assist me?
 -- no, it is not possible to manipulate the contents of an <input
type="file" ...>  field using JavaScript.  Sit back and think about it for a
second. If it *was possible*, I'd be able to build a script that looked for
fun files on your computer, dropped them into the form field and then upload
them to my server.  Major security risks with this.

You can however, still upload multiple files to a ColdFusion template:


html page:
-----------------------------------
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file1">

<input type="file" name="file2">

<input type="file" name="file3">
<submit>
</form>
-----------------------------------


cfm template:
-----------------------------------
<cfif IsDefined("form.file1">
 <cftry>
	<cffile
	action="upload"
	filefield="#form.file1#"
	destination="#pathToSave#" >

	<cfcatch type="any">
	</cfcatch>
</cftry>
</cfif>
-----------------------------------


Aaron Johnson
http://cephas.net/blog/
ajohnson at cephas.net





More information about the thelist mailing list