Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a form with several input fields that accept multiple files and I need to load the files from each element to a different destination. cffile upload only uploads the first file from each form field and uploadall puts them all in all the directories because it doesn't support the fieldname attribute.

<form name="someForm" id="someForm" action="process.cfm" enctype="multipart/form-data" method="post">
    <input type="file" multiple="multiple" name="fileSet1" />
    <input type="file" multiple="multiple" name="fileSet2" />
    <input type="file" multiple="multiple" name="fileSet3" />
    <input type="submit" value="update" />
</form>

This uploads one file to each destination:

<cffile action="upload" filefield="fileSet1" destination="dest1" nameconflict="overwrite">
<cffile action="upload" filefield="fileSet2" destination="dest2" nameconflict="overwrite">
<cffile action="upload" filefield="fileSet3" destination="dest3" nameconflict="overwrite">

This uploads all file to all destinations because filefield doesn't go with uploadall:

<cffile action="uploadall" filefield="fileSet1" destination="dest1" nameconflict="overwrite">
<cffile action="uploadall" filefield="fileSet2" destination="dest2" nameconflict="overwrite">
<cffile action="uploadall" filefield="fileSet3" destination="dest3" nameconflict="overwrite">
share|improve this question
1  
Can't you just use cffile to copy/move the files after uploadall dumps them to a directory? – Ben Koshy Nov 19 '12 at 20:57
I agree with Ben, the whole purpose for 'uploadall' is to batch upload a lot of files at once. If you need to do different things for each file then you will need to upload them individually or handle it after the 'uploadall' as Ben suggested. – Miguel-F Nov 19 '12 at 21:20
The idea is that three groups of files are being uploaded to three directories so it is still a batch upload, just three of them. Since we would be dealing with random file names how do you propose I sort them to move them to the correct location? I'm fine with a two step process just not sure what information I have available to make the determination of which directory to move too. – smoketx Nov 20 '12 at 17:22
what method are you using to upload multiple files in one form field? – Travis Nov 20 '12 at 18:45
See the first code block. It is HTML5. – smoketx Nov 20 '12 at 19:11

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.