上传:
//获取参数文件流,并将文件流转化成二进制数组,适应JSP与Servlet
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload sfu = new ServletFileUpload(factory); sfu.setFileSizeMax(102400000);
sfu.setSizeMax(204800000);
List items = null;
try {
items = sfu.parseRequest(request);
} catch (SizeLimitExceededException e) {
System.out.println("size limit exception!");
} catch(Exception e) {
e.printStackTrace();
}
Iterator iter = items==null?null:items.iterator();
while(iter != null && iter.hasNext()) {
FileItem item = (FileItem)iter.next();