commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert J. Carr" <>
Subject commons fileupload
Date Thu, 15 Jun 2006 19:14:07 GMT
I am attempting to use the fileupload package and having strange 
results.  I have a file type form element that I am uploading an xml 
file through to.  The xml file I'm uploading is about 1.1MB.  However, 
when I print some of the metadata about the uploaded FileItem, here's 
what I get:

content-type: text/xml
size: 2363688 (via getSize())
length: 2363688 (via get().length)

When I look in my tomcat temp directory, I see a file:


Which is the correct file, it is 1.1MB and passes diff.

However, when I attempt to write the file to disk:

item.write(File.createTempFile("portaltest-", null));

I get a file written:


Which is incorrect, and a size of 2.3 MB (which matches the size above).

I'm using the latest 1.1.1 release (but same thing happens with 1.1). 
To get my fileitems, I make this sequence of calls:

FileItemFactory factory = new DiskFileItemFactory();
PortletFileUpload upload = new PortletFileUpload(factory);
List<FileItem> items = (List<FileItem>) upload.parseRequest(request);

To add another twist, this seems to work fine for smaller files (less 
than about 50KB in size).

I'm also getting an exception thrown later, and not entirely sure where 
it is coming from.  It may be a red herring, but I'll include it for 
(No such file or directory)

So I have no idea what is going on.  My form is pretty basic ... here it 
is as well:

<form name="<portlet:namespace />fm" action="<portlet:actionURL />" 
method="post" enctype="multipart/form-data">
   <input type="file" name="<portlet:namespace />rdssxml" />

Any help would be appreciated.  Are there other upload packages similar 
to filupload that I could try?  I've always found the jakarta tools to 
be the most consistently well done, but I would like to test just for 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message