This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other Open Source Projects and the fly likes Apache Commons FileUpload with Zip Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
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: 41583
    
  54
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.


Ping & DNS - my free Android networking tools app
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: 41583
    
  54
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://aspose.com/file-tools
 
subject: Apache Commons FileUpload with Zip Files