I have "folder" filled with documents, that i need to upload, i already used apache fileUpload but this "upload the entire folder to the jvm heap memory" so if the user have a folder with 100mb of docs, the application will launch java heap size error.
So in java there is a way to read the "folder" and upload files one by one instead of charging 100mb of documents at once directly to the jvm heap memory?
-No, theres no possible way to add more mb on jvm heap size.
the java code
DiskFileUpload upload = new DiskFileUpload();
upload.setSizeThreshold(1024 * 1024 * 1);
upload.setSizeMax(-1);
List<FileItem> items = null;
try {
items = parseRequest(req, upload);
} catch (FileUploadException e) {
e.printStackTrace();
msg = new String[1];
msg[0] = e.getMessage();
session = req.getSession(true);
session.setAttribute("msg", msg);
resp.sendRedirect("front/Alerts.jsp?ok=false");
return;
}
protected List<FileItem> parseRequest(HttpServletRequest req, DiskFileUpload upload)
throws IOException, FileUploadException {
return upload.parseRequest(req);
}