Nate Drake wrote:
I have a question about multiple file uploads using arrays[1]. Say I have 4
text fields with a file input field "related" to each one on a JSP like
this:
<input type="text" name="attrVal"/> <s:file label="File (1)" name="attrImg"
/>
<input type="text" name="attrVal"/> <s:file label="File (2)" name="attrImg"
/>
<input type="text" name="attrVal"/> <s:file label="FIle (3)" name="attrImg"
/>
<input type="text" name="attrVal"/> <s:file label="FIle (4)" name="attrImg"
/>
The user must enter a value in the text field, but uploading a file isn't
required. If the user picks a file for "File(1)" and "File(4)", in my
Action class the attrImg File[] only has two values in it. This makes
sense, but I'm wondering, is there a way I can get Struts to include null
values in the File[] for the file upload fields (in this case 2 and 3) the
user didn't choose a file for? I need to keep the files associated with the
textfield data in my action, as it works now, I can't do that, because I
won't know which textfield the files are "related" to. I can't give each
upload field a unique name, as the user is able to add a new textfield/file
input pair dynamically.
Provide your own indexes in the field name--otherwise S2 has no way of
knowing anything was "skipped".
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org