Package org.apache.commons.fileupload.servlet

Examples of org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest()


            String encoding = request.getCharacterEncoding();
            if (encoding == null) {
                encoding = "UTF-8";
            }

            Iterator iterator = upload.parseRequest(request).iterator();
            FileItem item;
            while (iterator.hasNext()) {
                item = (FileItem) iterator.next();
                if(LOGGER.isDebugEnabled()) {
                    if (item.isFormField()) {
View Full Code Here


        ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
        List lst = null;
        Locale locale = UtilHttp.getLocale(request);

        try {
            lst = fu.parseRequest(request);
        } catch (FileUploadException e) {
            request.setAttribute("_ERROR_MESSAGE_", e.toString());
            return "error";
        }
View Full Code Here

            GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");

            ServletFileUpload dfu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
            java.util.List lst = null;
            try {
                lst = dfu.parseRequest(request);
            } catch (FileUploadException e4) {
                request.setAttribute("_ERROR_MESSAGE_", e4.getMessage());
                Debug.logError("[UploadContentAndImage.uploadContentAndImage] " + e4.getMessage(), module);
                return "error";
            }
View Full Code Here

            ServletFileUpload dfu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
            //if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]DiskFileUpload " + dfu, module);
            java.util.List lst = null;
            try {
                lst = dfu.parseRequest(request);
            } catch (FileUploadException e4) {
                request.setAttribute("_ERROR_MESSAGE_", e4.getMessage());
                Debug.logError("[UploadContentAndImage.uploadContentAndImage] " + e4.getMessage(), module);
                return "error";
            }
View Full Code Here

      if(request.getContentType() != null &&
          request.getContentType().startsWith("multipart/form-data;")) {
       
        FileItemFactory fif = new DiskFileItemFactory();
        ServletFileUpload sfu = new ServletFileUpload(fif);
        List itemList = sfu.parseRequest(request);
        Document paperDoc = null;
        String paperName = null;
        for(Object o : itemList) {
          FileItem item = (FileItem)o;
          if(item.getFieldName().equals("paper")) {
View Full Code Here

    ServletFileUpload upload = new ServletFileUpload(factory);
    List<FileItem> items;
   
    try
    {
      items = upload.parseRequest(request);
      Iterator iter = items.iterator();
   
      while (iter.hasNext())
      {
        FileItem item = (FileItem)iter.next();
View Full Code Here

        if(isMultipart){
            //构造一个文件上传处理对象
            ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
            try{
                //解析表单中提交的所有文件内容
                for(Iterator items=upload.parseRequest(request).iterator();items.hasNext();){
                    FileItem item = (FileItem) items.next();
                    if(!item.isFormField()){
                        //取出上传文件的文件名称
                        String name = item.getName();
                        params.put(item.getFieldName(), name);
View Full Code Here

        // Create a new file upload handler
        ServletFileUpload servletFileUpload = new ServletFileUpload(diskFileItemFactory);
        // Parse the request
        try {
            // Get the multipart items as a list
            List<FileItem> listFileItems = (List<FileItem>) servletFileUpload.parseRequest(httpServletRequest);
            // Create a list to hold all of the parts
            List<Part> listParts = new ArrayList<Part>();
            // Iterate the multipart items list
            for(FileItem fileItemCurrent : listFileItems) {
                // If the current item is a form field, then create a string part
View Full Code Here

        if(isMultipart){
            //构造一个文件上传处理对象
            ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
            try{
                //解析表单中提交的所有文件内容
                for(Iterator items=upload.parseRequest(request).iterator();items.hasNext();){
                    FileItem item = (FileItem) items.next();
                    if(!item.isFormField()){
                        //取出上传文件的文件名称
                        String name = item.getName();
                        if(name.lastIndexOf("/")>-1){
View Full Code Here

    // Create a new file upload handler
    ServletFileUpload upload = new ServletFileUpload(factory);
    upload.setSizeMax( uploadLimitKB*1024 );

    // Parse the request
    List items = upload.parseRequest(req);
    Iterator iter = items.iterator();
    while (iter.hasNext()) {
        FileItem item = (FileItem) iter.next();

        // If its a form field, put it in our parameter map
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.