commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Coakley" <brian_coak...@hotmail.com>
Subject FileUpload problem/question
Date Thu, 22 Jan 2004 08:52:41 GMT
I've used the code right from the upload example and I get no results from upload.parseRequest(request);
 There is other data on the page that is updating just fine.  Am I missing something obvious?
 Thanks, Brian Coakley

      // Check that we have a file upload request
      boolean isMultipart = FileUpload.isMultipartContent(request);
      if(isMultipart){

        // Create a new file upload handler
        DiskFileUpload upload = new DiskFileUpload();

        // Parse the request
        List /* FileItem */ items = upload.parseRequest(request);

        // Process the uploaded items
        Iterator iter = items.iterator();
        while (iter.hasNext()) {
          FileItem item = (FileItem) iter.next();

          if (item.isFormField()) {
            // Process a regular form field
            String name = item.getFieldName();
              String value = item.getString();
            } else {
            // Process a file upload
            String fieldName = item.getFieldName();
              fileName = item.getName();
              String contentType = item.getContentType();
              boolean isInMemory = item.isInMemory();
              long sizeInBytes = item.getSize();
            }
        }
      }


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message