This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Apache Commons FileUpload with Zip Files

 
Awet Haddis
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Awet Haddis
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic