Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8729013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:45:20+00:00 2026-06-13T08:45:20+00:00

I upload the file which I browse with input type=file in my web App.

  • 0

I upload the file which I browse with input type="file" in my web App. The issue is I get the FileItem list size as 0 though I can see all uploaded file info under

request -> JakartaMutltiPartRequest -> files attribute

Here is java code that reads the file

public InputStream parseRequestStreamWithApache(HttpServletRequest request)
  throws FileUploadException, IOException {
  InputStream is = null;
  FileItemFactory factory = new DiskFileItemFactory();
  ServletFileUpload upload = new ServletFileUpload(factory);
  List items = upload.parseRequest(request);
  // here the item size is 0 ,i am not sure why i am not getting my file upload in browser with type="file"
  // but If inspect request in debugger i can see my file realted info in request--->JakartaMutltiPartRequest----->files attribute
  Iterator iter = items.iterator();
  while (iter.hasNext()) {
    FileItem item = (FileItem) iter.next();

    if (!item.isFormField()) {
      is = item.getInputStream();
    }
  }

  return is;
}

EDIT:

Here is JSP part:

<form NAME="form1" action="customer/customerManager!parseRequestStreamWithApache.action" ENCTYPE="multipart/form-data"   method="post" >
     <TABLE >
         <tr>
              <th>Upload File</th>
                  <td>
                   <input name="fileUploadAttr" id="filePath"  type="file" value="">
                 </td>
                  <td > 
                 <Input type="submit" value ="uploadFile"/>
                  </td>
          </tr>
    </TABLE>
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:45:21+00:00Added an answer on June 13, 2026 at 8:45 am

    As I said in a comment to the same question, you posted earlier, this is most likely because you have parsed the request already before.
    The files are part of the request body and you can parse it only one time.

    Update:

    I usually do use commons-upload in that way:

    if (ServletFileUpload.isMultipartContent(request)) {
        ServletFileUpload fileUpload = new ServletFileUpload();
        FileItemIterator items = fileUpload.getItemIterator(request);
        // iterate items
        while (items.hasNext()) {
            FileItemStream item = items.next();
            if (!item.isFormField()) {
                is = item.openStream();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file, which the users browse and hit the upload button, i
In my django app, I have a view which accomplishes file upload.The core snippet
How can one best test a controller action which receives a file upload using
I'm using a script which replaces the usual file upload input with whatever image
I have written <input type=file> which results in one small text box along with
I am implementing a file upload tool using Silverlight. In this I can browse
I'm trying to upload a file using ActionScript, which I can do quite easily
I have a HTML file upload field from which I'm reading the file name
I have a form which binds a model and a file upload using the
I have a GWT screen in which i have a file upload bar,whenever i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.