I referred How to upload files to server using JSP/Servlet? guide to upload the files with multipart/form-data using Servlet.
Before using
@WebServlet("/upload")
@MultipartConfig
Annotations I am able to upload the file to the server but unable to read control field data. Now I used Annotations with my Servlet with the action control.
Problem is able to read the control field values but files is not uploading into server. Used this snippets
FileItemFactory factory = new DiskFileItemFactory();
//Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
File uploadedFile;
//Parse the request
List items = upload.parseRequest(request);
Iterator iterator = items.iterator();
while (iterator.hasNext()) {
}
I am getting the itmes size as 0 (ZERO) when I pasre the request while uploading the file. What may be the issue in my case ?
Thanks in advance!!