aspose file tools
The moose likes Servlets and the fly likes Apache Commons FileUpload with Zip Files Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Apache Commons FileUpload with Zip Files" Watch "Apache Commons FileUpload with Zip Files" New topic
Author

Apache Commons FileUpload with Zip Files

Awet Haddis
Greenhorn

Joined: Jan 25, 2011
Posts: 11
I am using the Apache FileUpload library to allow a user to upload a .zip file to my webpage. The trouble is, the library seems to store the
files as items. To get around this I cast them as zip files and then used java.util.zipfile classes and methods. The program stores a .tmp file in the
directory but I can tell that it has not been decompressed because it is the same size as the compressed file. I would appreciate any help or insight any one
may provide on this issue. Thank you in advance.



Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35442
    
    9
The trouble is, the library seems to store the files as items.

I don't quite follow - are you saying that the uploaded files are not byte-for-byte identical with the original files?

I can tell that it has not been decompressed because it is the same size as the compressed file.

If you upload a ZIP file, why would it get decompressed? That's not what FileUpload does.


Android appsImageJ pluginsJava web charts
Awet Haddis
Greenhorn

Joined: Jan 25, 2011
Posts: 11
Ulf Dittmer wrote:
The trouble is, the library seems to store the files as items.

I don't quite follow - are you saying that the uploaded files are not byte-for-byte identical with the original files?

I can tell that it has not been decompressed because it is the same size as the compressed file.

If you upload a ZIP file, why would it get decompressed? That's not what FileUpload does.


My class ZippedFile() takes in an 'item' (created by fileupload methods) and casts it as a 'zipfile'. In my method 'decompress' I attempt
to decompress the file. I don't think I was successful because it is byte-byte identical, meaning it was not decompressed.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35442
    
    9
Byte-for-byte identical seems unlikely - the output consist of multiple files, whereas the input is a single zip file, no?

If memory serves, it's possible to use ZIP as an archiver only, with no compression; make sure that's not what you have here.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Apache Commons FileUpload with Zip Files
 
Similar Threads
Problem unzipping with ZipInputStream, containing filename with Swedish characters
problem in attached file .
unzip problem, I give up now
Problme with unzipping
Problem with Unzipping