New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support MultipartFile-array property [SPR-2784] #7471
Comments
|
Maarten Winkels commented 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 commented 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? |
|
Cameron McEwing commented Hi There, Love to see this one fixed, as it limits the ability to do multiple flie multipart uploads from Adobe Flex. Yes their are some workarounds ... http://dhruba.name/2008/12/27/implementing-single-and-multiple-file-multipart-uploads-using-spring-25/ . But we really shouldn't need these. Cheers Cameron |
|
Arjen Poutsma commented Fixed. The MultipartRequest now has a List<MultipartFile> getFiles(String) method, as well as a MultiValueMap<String, MultipartFile> getMultiFileMap() method. |
|
Jonathan Nuñez Aguin commented bindMultipartFiles is not using the news methods getFiles(String) and getMultiFileMap(), in this way the property "aFileArray" is not bound correctly. |
|
Juergen Hoeller commented Reopened for revisiting DataBinder's MultipartFile support. Juergen |
|
Jonathan Nuñez Aguin commented If someone wants to check this error: public class Bean {MulitpartFile[] aFileArray;} <form> |
|
Juergen Hoeller commented Finally fixed for 3.0.4: WebDataBinder and Juergen |
|
Laurent Bois commented Hi I recently downloaded Spring 3.0.4 from http://www.springsource.com/download/community?sid=723222 And i need to do multi file upload in a spring webflow I tried MultipartFile[] files; public void setFiles(MultipartFile[] files) { public MultipartFile[] getFiles() { public MultiPartFileUploadHandler processFiles() { In the HTML form : <form:form modelAttribute="fileUploadHandler" method="post" enctype="multipart/form-data"> </form:form> I use the tip for Firefox 3.6 src http://hacks.mozilla.org/2009/12/multiple-file-input-in-firefox-3-6/ But this doesn't work on server side (method processFiles from the Model above MultipartFileHandler)... i only get the first file from the selected files chosen in the file picker from the HTML form Thanks for your help |
|
Laurent Bois commented I also changed the HTML form, cf beginning of this thread. </form:form> Stil have the problem ...only the first file of the list is handled. Laurent |
|
Stevo Slavić commented I've just created improvement request SWF-1422, to have this same feature available in Spring Webflow - anyone interested, please vote for that ticket. I wonder why haven't "MultipartFile getFile(String name)" and "Map<String, MultipartFile> getFileMap()" methods in org.springframework.web.multipart.MultipartRequest been at least marked as deprecated if not removed, since getFiles and getMultiFileMap seem to cover well both case with single and multiple MultipartFile values per request parameter name. |
Maarten Winkels opened SPR-2784 and commented
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.
Affects: 2.0 final
Attachments:
Issue Links:
Referenced from: commits 255d1ad, 66a7995, b2b1ff6, 9b3fbc2
7 votes, 12 watchers
The text was updated successfully, but these errors were encountered: