e xem trên mạng có đoạn code này e ko hiểu : sao cái kích thích vị trí tạm lại bé hơn kích thước tối đa của file tải lên @@ thế thì nó sao chứa dc nhỉ ?!
public static void Uploadsinglefile(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
final String Address = "E:\\";
final int maxMemorySize = 1024 * 1024 * 3; // 3MB
final int maxRequestSize = 1024 * 1024 * 50; // 50 MB
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (!isMultipart)
{
request.setAttribute("message", "not have enctypr: multipart/form-data");
}
DiskFileItemFactory factory = new DiskFileItemFactory();
// Set factory constraints
factory.setSizeThreshold(maxMemorySize);
factory.setRepository(new File(System.getProperty("java.io.tmpdir")));
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// Set overall request size constraint
upload.setSizeMax(maxRequestSize);
......