Earlier this week I blogged about the new multi-file uploader in ColdFusion 9. While that control handles the front end support for handling multiple uploads, it works hand in hand with a new update to the cffile tag to support multiple file uploads. I did some digging into this and discovered some interesting tidbits.
First - the docs mention that when using cffile/action="uploadall", you get an array of CFFILE structures. This is true - but you will notice that if you use the multi-file uploader that the array will always contain one item. Why? The front end UI control may upload 2 or more files, but it's only going to upload one at a time. In fact, cffile/action="uploadAll" is kind of pointless with that control. It will always only have one upload at a time.
Second - you certainly can use cffile/action="uploadall" without using the new multi-file uploader. You can use it for hard coded forms like so:
<form action="test3.cfm" enctype="multipart/form-data" method="post">
<input type="file" name="file1" id="file1"><br/>
<input type="file" name="file2" id="file2"><br/>
<input type="file" name="file3" id="file3"><br/>
<input type="submit" name="submit">
</form>
In this case, cffile/action="upload" automatically finds all the file fields and processes them in order. Unfortunately you don't get information about the particular form field. The order seems to match the order of the form itself, but I'm not sure that is guaranteed. I'd probably say it is safe to assume it does.