Blob fileContent = Hibernate.createBlob(item.getInputStream());
annex.setFileContent(fileContent);
annexService.addAnnex(annex);
DiskFileItemFactory factory = new DiskFileItemFactory();
// 设置缓冲区大小,这里是5kb
factory.setSizeThreshold(1024 * 5);
ServletFileUpload upload = new ServletFileUpload(factory);
// 设置允许用户上传文件大小,单位:字节
List fileItems = upload.parseRequest(request);
Iterator iter = fileItems.iterator();
while (iter.hasNext())
{
PmsAnnex annex = new PmsAnnex();
FileItem item = (FileItem) iter.next();