commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tushar Kale" <tk...@w3apps.com>
Subject Getting file length while using stream api of file upload
Date Sat, 11 Jul 2009 15:04:07 GMT
Hello:
I am using Streaming API for of FileUpload. 
How do I get the length of the file?  

In the following code, the item.getHeaders() call returns  null headers.

 FileItemIterator iter = upload.getItemIterator(request);
            while (iter.hasNext()) {
                FileItemStream item = iter.next();
                String name = item.getFieldName();
                InputStream stream = item.openStream();

                FileItemHeaders headers = item.getHeaders();
                if (headers == null)
                {
                    System.out.println("headers are null");
                } else {
                    System.out.println("headers are not null");
                }
}

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