Package org.apache.commons.fileupload

Examples of org.apache.commons.fileupload.FileItemFactory


            boolean discard = false;

            //
            // parse multipart request and extract the file
            //
            FileItemFactory factory = new DiskFileItemFactory(1048000, new File(System.getProperty("java.io.tmpdir")));
            ServletFileUpload upload = new ServletFileUpload(factory);
            upload.setSizeMax(-1);
            upload.setHeaderEncoding("UTF8");
            try {
                for (Iterator it = upload.parseRequest(request).iterator(); it.hasNext();) {
View Full Code Here


    FileItem item = null;
    String comment = null;
    FileItem imageFileFormField = null;
    try
    {
      FileItemFactory factory = new DiskFileItemFactory();
      ServletFileUpload upload = new ServletFileUpload(factory);
      List<?> items = upload.parseRequest(request);
      Iterator<?> iter = items.iterator();
      while(iter.hasNext())
      {
View Full Code Here

    public void doPost( HttpServletRequest req, HttpServletResponse res ){

      File disk = null;
      FileItem item = null;
      FileItemFactory factory = new DiskFileItemFactory();
      Iterator iter = null;
      List items = null;
      ServletFileUpload upload = new ServletFileUpload( factory );
      ServletOutputStream out = null;
      try{
View Full Code Here

    ServletOutputStream out = null;

    try {
      HttpRequestHolder.setServletRequest(request);
      FileItemFactory factory = new DiskFileItemFactory();
      ServletFileUpload upload = new ServletFileUpload(factory);

      List<FileItem> items = upload.parseRequest(request);
      response.setContentType("text/xml");
      out = response.getOutputStream();
View Full Code Here

        String path = request.getParameter("path");
        resp.setContentType("application/json");
        boolean explodeZip = "1".equals(request.getParameter("explodeZip"));

        // Create a factory for disk-based file items
        FileItemFactory factory = new DiskFileItemFactory();

        // Create a new file upload handler
        ServletFileUpload upload = new ServletFileUpload(factory);

        ArrayList<String> fileNames = new ArrayList<String>();
View Full Code Here

      String timestamp = format.format(new java.util.Date());
     
      if(ServletFileUpload.isMultipartContent(req))
      {
        // we'll store them temporarily on disk, then move them to the DB
        FileItemFactory factory = new DiskFileItemFactory();
       
        logger.debug("factory=" + factory);
       
        // upload handler
        ServletFileUpload upload = new ServletFileUpload(factory);
View Full Code Here

   
        // process only multipart requests
        if (ServletFileUpload.isMultipartContent(req)) {

            // Create a factory for disk-based file items
            FileItemFactory factory = new DiskFileItemFactory();

            // Create a new file upload handler
            ServletFileUpload upload = new ServletFileUpload(factory);

            // Parse the request
View Full Code Here

     *
     * @throws Exception
     */
    public void testAddPathInfo() throws Exception
    {
        FileItemFactory factory = new DiskFileItemFactory(10240, null);

        assertEquals("keySet() is not empty!", 0, parameterParser.keySet().size());

        FileItem test = factory.createItem("upload-field", "application/octet-stream", false, null);
        // Push this into the parser using DefaultParameterParser's add() method.
        ((DefaultParameterParser) parameterParser).add("upload-field", test);

        assertEquals("FileItem not found in keySet()!", 1, parameterParser.keySet().size());

View Full Code Here

     *
     * @throws Exception
     */
    public void testAddPathInfo() throws Exception
    {
        FileItemFactory factory = new DiskFileItemFactory(10240, null);

        assertEquals("keySet() is not empty!", 0, parameterParser.keySet().size());

        FileItem test = factory.createItem("upload-field", "application/octet-stream", false, null);
        // Push this into the parser using DefaultParameterParser's add() method.
        ((DefaultParameterParser) parameterParser).add("upload-field", test);

        assertEquals("FileItem not found in keySet()!", 1, parameterParser.keySet().size());

View Full Code Here

        }
    }

    protected ServletFileUpload createFileUpload()
    {
        FileItemFactory factory = new DiskFileItemFactory(repositoryThreshold, new File(repositoryLocation));
        ServletFileUpload upload = new ServletFileUpload(factory);

        // set maximum file upload size
        upload.setSizeMax(maxRequestSize);
        upload.setFileSizeMax(maxFileSize);
View Full Code Here

TOP

Related Classes of org.apache.commons.fileupload.FileItemFactory

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.