I am giving the form a dynamic number of file upload fields. So on the form side, I'm looping through this dynamic number (say 3, as index 'm'), and naming each filefield input 'ResumeFile#m#'. On the action page, I'm getting an error if one of the filefields is not filled in. When all 3 filefields are filled in, it works fine.
The error is (here, when filefield 2 is not filled in):
The form field Form.ResumeFile2 did not contain a file.
Here's my code creating the form:
<cfset numUploads = 3>
<cfform name="uploadMultipleResumes" action="uploadMultipleResumes.cfm" enctype="multipart/form-data" >
<cfinput name="EmployeeID" type="hidden" value="#form.EmployeeID#">
Resume File(s): *<BR>
<cfloop from="1" to="#numUploads#" index="j">
<cfinput name="ResumeFile#j#" type="file" size="50">
</cfloop>
<BR />
<cfinput name="Submit" type="submit" value="Upload Multiple Resumes">
</cfform>
Here's my code (abbreviated) from the action page. I've tried lots of combinations of how to check if each filefield is not filled in, all of which allow a blank input to pass through and get to the error I mentioned above.
<!--- Loop over multiple file fields --->
<cfloop from="1" to="#numUploads#" index="m">
<cfif 'Form.ResumeFile#m#' is not "">
<cffile action="upload" filefield="#Evaluate('Form.ResumeFile#m#')#" nameconflict="makeunique" destination="#destinationPath#">
</cfif>
</cfloop>
Even if I've already tried it, I will try all suggestions! I've been on this for days and I know there's an answer!
Thanks so much!
Here's the image of the error