Package org.apache.commons.fileupload.servlet

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


public class UploadFileUtils {

  public static FileItem getUploadFile(HttpServletRequest request, String file) throws Exception {
    ServletFileUpload fileUpload = new ServletFileUpload(new DiskFileItemFactory());
    List<FileItem> list = fileUpload.parseRequest(request);
    for(FileItem fileItem: list) {
      if (fileItem.getFieldName().equals(file)) {
        return fileItem;
      }
    }
View Full Code Here


        String studyRegionId = "";
       
        try
        {
         
          List<FileItem> items = upload.parseRequest(req);
          logger.debug("items=" + items);
         
          for(FileItem item : items)
          {
            logger.debug("item=" + item);
View Full Code Here

   
   
    // Parse the request
    List<?> /* FileItem */ items;
    try {
      items = upload.parseRequest(request);
    }
    catch (FileUploadException e) {
      e.printStackTrace();
      response.sendError(HttpServletResponse.SC_EXPECTATION_FAILED, e.getMessage());
      return;
View Full Code Here

      totalBytes = request.getContentLength();

      onUploadStarted(totalBytes);
      try
      {
        items = fileUpload.parseRequest(ctx);
      }
      finally
      {
        onUploadCompleted();
      }
View Full Code Here

        onUploadCompleted();
      }
    }
    else
    {
      items = fileUpload.parseRequest(request);
    }

    // Loop through items
    for (final FileItem item : items)
    {
View Full Code Here

    //
    // process upload request
    //
    @SuppressWarnings("unchecked")
    List<FileItem> fileItems = upload.parseRequest(request);

    _logger.debug(serverPath);

    //
    // Only save .wgt files and ignore any others in the POST
View Full Code Here

       
        Map<String, String> formInput = FastMap.newInstance();
        ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
        List<FileItem> lst = null;
        try {
           lst = UtilGenerics.checkList(fu.parseRequest(request));
        } catch (FileUploadException e4) {
            return e4.getMessage();
        }
               
        FileItem fi = null;
View Full Code Here

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

            ServletFileUpload dfu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
            List<FileItem> lst = null;
            try {
                lst = UtilGenerics.checkList(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);
            List<FileItem> lst = null;
            try {
                lst = UtilGenerics.checkList(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 fu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
        List<FileItem> lst = null;
        Locale locale = UtilHttp.getLocale(request);

        try {
            lst = UtilGenerics.checkList(fu.parseRequest(request));
        } catch (FileUploadException e) {
            request.setAttribute("_ERROR_MESSAGE_", e.toString());
            return "error";
        }
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.