0

I am a newbie to spring and mvc framework. I am going through the framwork and i wanted to understand the File upload (multiple) and use spring to load my complex object.

I have seen example using MultiPartFile for single file upload.

I tried the same for trying out the multiple file upload but I failed where i tried to make generic (like allowing the user to upload as many files).

Is there a way to do it in a optimal way to have the files available as list in the controller?

Thank you for reading!!!

is there a way to handle this without using multipart resolver?

2 Answers 2

1

Take a look at my answer to a similar question here:

Preserving value for <form:input type="file"> with Spring MVC

This explains our approach of an asynchronous file upload handling and processing of them on a final form submit.

Sign up to request clarification or add additional context in comments.

2 Comments

This is useful. However i thought of handling the list of multipartfile as a bean and then load them into my model class in Controller. Not sure if that is a acceptable approach
The problem with a single submit and alot of files is that if there is a problem like invalid values you have to reupload all files again. That was the main reason for me to implement that solution. If one upload fails the user can just reupload it again. Onces everything is fine the user clicks submit and we are still able to handle additional validation of the files or other form values.
0

I have used jquery.form.js. You can find example using Google. If not you can tell me to post a link. Moreover you should investigate how the browsers will handle the upload process (i.e.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.