Package com.vsked.fileoperate

Examples of com.vsked.fileoperate.UploadListener$FileUploadStats


  private void doFileUpload(HttpSession session, HttpServletRequest request,
      HttpServletResponse response) throws IOException {
    response.setContentType("text/html;charset=utf-8");
    try {
      //创建UploadListener对象
      UploadListener listener = new UploadListener(request.getContentLength());
      listener.start();//启动监听状态
      //将监听器对象的状态保存在Session中
      session.setAttribute("FILE_UPLOAD_STATS", listener.getFileUploadStats());
      //创建MonitoredDiskFileItemFactory对象
      FileItemFactory factory = new MonitoredDiskFileItemFactory(listener);
      //通过该工厂对象创建ServletFileUpload对象
      ServletFileUpload upload = new ServletFileUpload(factory);
      //将转化请求保存到list对象中
      List items = upload.parseRequest(request);
      //停止使用监听器
      listener.done();
      boolean hasError = false;
      //循环list中的对象
      for (Iterator i = items.iterator(); i.hasNext();) {
        FileItem fileItem = (FileItem) i.next();
        if (!fileItem.isFormField()) {//如果该FileItem不是表单域
View Full Code Here

TOP

Related Classes of com.vsked.fileoperate.UploadListener$FileUploadStats

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.