Issue Details (XML | Word | Printable)

Key: SPR-2784
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Juergen Hoeller
Reporter: Maarten Winkels
Votes: 3
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Spring Framework

Support MultipartFile-array property

Created: 01/Nov/06 03:26 AM   Updated: 11/May/09 11:15 AM
Component/s: SpringWEB
Affects Version/s: 2.0 final
Fix Version/s: 3.0 RC1

Time Tracking:
Not Specified

File Attachments: 1. Text File patch.txt (6 kB)



 Description  « Hide
When posting multiple non-file form fields with the same name, the CommonsMultipartResolver(as CommonsFileUploadSupport ) recognizes this as an array property. When posting multiple file form fields with the same name, the property value is overwritten. If the same logic would be applied, a bean could be populated with a MulitpartFile[] property.

exmaple:

public class Bean {
private String aString;
private String[] aStringArray;
private MultipartFile aFile;
private MulitpartFile[] aFileArray;
}

<form>
<input name="aString" type="text"/>
<input name="aStringArray" type="text"/>
<input name="aStringArray" type="text"/>
<input name="aFile" type="file"/>
<input name="aFileArray" type="file"/>
<input name="aFileArray" type="file"/>
</form>

if this forms is processed with the CommonsMultipartResolver, the String and String[] properties will be populated correctly (containing the two values in he array), the MultipartFile property will be filled correctly, but the MultipartFile[] property will contain only the last file.



 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Maarten Winkels added a comment - 01/Nov/06 06:37 AM
The attached patch implements this improvement for commons-upload. It seems that COS doesn't support file parts with the same name, thus the feature cannot be implemented there.

John David Dunlap added a comment - 07/May/09 02:55 PM
As I understand it, COS support was removed from Spring in 2.5. That being the case, would it be possible to get this implemented?