Uploading Multiple Files with Coldfusion

I need help on how to construct uploading multiple files on one submission.

I have the display code as follows:

  <td colspan="2"><strong>Upload List: </strong> <br>
  <input type="file" name="uploadfile" size="40">

Action File:

<cfif isdefined('uploadfile') and uploadfile neq "">
      <cfset uploadpath = 'c:\my schoollist\list\'>
      <cfset subdir = #uploadpath#&#get_list_info.id#&'\'>
      <cfif  NOT DirectoryExists(subdir)>
            <cfdirectory action="create" directory="#subdir#">
      <!--- Upload File --->
      <cffile action="UPLOAD" destination="#subdir#" nameconflict="MAKEUNIQUE" filefield="uploadfile">

Thanks -

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

1 <cfset numberoffields = 10>
2  <cfif isdefined("form.upload")>
3    <cfset message = "">
4    <cfloop index="i" from="1" to="#variables.numberoffields#" step="1">
5      <cfset filename = "form.file" & #i#>
6      <cfif evaluate(variables.filename) neq "">
7        <cffile action="UPLOAD"
8           destination="c:cfusionmxwwwrootNAPAfiles"
9           nameconflict="OVERWRITE"
10           filefield="#variables.filename#">
11        <cfset message = message & ",File%20#i#%20(#file.serverfile#)%20was%20uploaded">
12      <cfelse>
13        <cfset message = message & ",File%20#i#%20was%20empty">
14      </cfif>
15    </cfloop>
16    <cflocation url="FileUpload.cfm?msg=#variables.message#">
18 <cfelse>
19   <h2>File Upload</h2>20    <cfif isdefined("url.msg")>
21       <div style="color:#FF0000;">
22       <cfloop list="#url.msg#" index="i">
23         <cfoutput>#i#</cfoutput><br />
24       </cfloop>
25       </div>
26    </cfif>
27   <form action="FileUpload.cfm" enctype="multipart/form-data" method="post">
28      <cfloop index="i" from="1" to="#variables.numberoffields#" step="1">
29      <cfset filename = "file" & #i#>
30      <input type="File" name="<cfoutput>#variables.filename#</cfoutput>" /><br />
31      </cfloop>
32  <input type="Submit" name="upload" value="upload">
33  </form>
34 </cfif>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.