How to get file contents from a MultipartHttpServletRequest object?
12,719
MultipartHttpServletRequest extends MultipartRequest, which has methods for accessing the files.
You can do this:
MultipartFile file = request.getFile(paramName);
Author by
Ch Faizan Mustansar
Updated on June 05, 2022Comments
-
Ch Faizan Mustansar almost 2 years
I would like to upload a file from the web page using this strategy. i.e. Ajax file upload tutorial . It is going all fine, but the issue is on the server side, where I want to open this file and read its contents. I am using the following signature for the method which is called on the submit of the form. i.e.
public @ResponseBody String getFile(MultipartHttpServletRequest request)
Can any body please let me know that how can I extract the contents of the file?