就能正確取出中文了
ServletFileUpload upload = new ServletFileUpload(factory); upload.setHeaderEncoding("utf-8"); ListReference:items = null; try { items = upload.parseRequest(request); // System.out.println("item is added."); } catch (FileUploadException e) { System.out.println("FileUploadException:" + e.getMessage()); } if (items != null) { // System.out.println("items count:" + items.size()); Iterator iter = items.iterator(); while (iter.hasNext()) { FileItem item = iter.next(); String filename = item.getName(); } }
servlet file upload filename encoding
沒有留言:
張貼留言
留個話吧:)