I am trying to implement an HTML5 input field that lets the user select multiple files to upload. I have the following in my form:
<form method="post" enctype="multipart/form-data" action="index.cfm">
<input type="file" name="Images" id="Images" multiple="multiple" accept="image/jpeg, image/gif, image/png, application/zip" />
...
I am able to select multiple files in the browser, then click upload, but I'm not sure how to handle the form post with ColdFusion. I thought the following would work, but this only uploads the last file I selected:
<cfloop list="#attributes.Images#" index="Image">
<cffile
destination = "#ExpandPath(Trim(request.TempFolder))#"
filefield = "Images"
action = "upload"
nameconflict = "MakeUnique"
result = "UploadedTempFile"
>
<cfoutput>#UploadedTempFile.serverFile#<br /></cfoutput>
</cfloop>
Can someone explain to me how to loop through all the files submitted through my one form field so I can handle the files individually? Thanks!
<cffile action="uploadAll" />
? It's CF9 only, and I haven't tested it myself, but that may do the trick. In CF8, I'm just getting the one Images field. – Dan Short Sep 7 '11 at 18:21cffileupload
tag in CF9. I'm honestly not sure if the solution I provided would even work... – Dan Short Sep 7 '11 at 18:50uploadall
work in CF9 and get back to you. – Dan Short Sep 7 '11 at 19:56