• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Apache Commons FileUpload with Zip Files

 
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.



 
Rancher
Posts: 43016
76
  • 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
Posts: 43016
76
  • 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.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic