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:

upload_000000014.xml

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:

portaltest-64578.tmp

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 completeness:

java.io.FileNotFoundException: /opt/java/LiferayPro3.6.1/temp/upload__41c20f98_10bd8eb6a9d__7ffe_00000002.tmp (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" />
</form>

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 sanity.

Thanks-
Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to