[
https://issues.apache.org/struts/browse/STR-2112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Joe Germuska closed STR-2112.
-----------------------------
Resolution: Duplicate
Assignee: (was: Struts Developers)
This appears to be a duplicate of STR-487, which has a patch and a test.
> [upload] Support file uploads with the same parameter name
> ----------------------------------------------------------
>
> Key: STR-2112
> URL: https://issues.apache.org/struts/browse/STR-2112
> Project: Struts 1
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.1 Final
> Environment: Operating System: All
> Platform: All
> Reporter: peilinz
> Priority: Minor
>
> It will be helpful (and also consistant with regular parameters) to support
> putting uploaded files in a FormFile array when the HTML input parameter names
> are the same for several file uploads.
> I propose the following change to the addFileParameter() method in class
> org.apache.struts.upload.CommonsMultipartRequestHandler:
> protected void addFileParameter(FileItem item) {
> FormFile formFile = new CommonsFormFile(item);
>
> Object o = elementsFile.get(item.getFieldName());
> if(o==null) {
> elementsFile.put(item.getFieldName(), formFile);
> elementsAll.put(item.getFieldName(), formFile);
> }
> else {
> FormFile[] files;
> if(o instanceof FormFile) {
> files = new FormFile[2];
> files[0] = (FormFile)o;
> files[1] = formFile;
> }
> else {
> FormFile[] oldFiles = (FormFile[])o;
> files = new FormFile[oldFiles.length+1];
> System.arraycopy(oldFiles, 0, files, 0, oldFiles.length);
> files[files.length-1] = formFile;
> }
> elementsFile.put(item.getFieldName(), files);
> elementsAll.put(item.getFieldName(), files);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.