• Post Reply Bookmark Topic Watch Topic
  • New Topic

Upload contents of a zip File

 
kanchi mehrotra
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,

I have to parse through a zip file which contains a folder and a file and upload these separetly onto the server. The zip file is obtained in the formof an inputstream from teh client side, using http request.
I am not sure how to parse a inpustream and check for a folder or a file and then proceed to the upload accordingly. Can anyone help me ?

If there is an alternate way of passing information to the upload function apart from passing it as an inputstream, then please let me know. This is what I have for now

MultipartFile GetFile = null;
GetFile = request.getFile(Param);
UploadFile(GetFile.getInputStream());

public UploadFIle(InputStream in) {
// Need to parse this inputsream
}
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume this is in a servlet? Anticipating such, I have moved this to the Servlets forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look through the ServletsFaq and the JspFaq. Both have entries on file uploading.
 
Paul Clapham
Sheriff
Posts: 21863
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the impression that the question is about the code which uploads the data, as opposed to the code which receives the uploaded data. But the post is too unclear for me to be certain.
 
kanchi mehrotra
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply. You are correct , I want to know how to read the inputstream passed in so that I can get the path of the folder contained within the zip and the path of the file, thus uploading them .
 
Paul Clapham
Sheriff
Posts: 21863
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of us is correct? Please try to be clear, as it's still impossible for me to tell whether you are asking about code which sends the upload or code which receives the upload.
 
kanchi mehrotra
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know about the code that will use the inputstream to upload the data . It should be able to check the inputstream for the relevant files and upload those files onto the server. Uploading the files is not an issue, I want to know how to check the inputstream for relevant files. Does that make sense ? SO the which sends the upload.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, still not clear. You seem to say one thing, and then say the other.

How are you uploading the file(s) -- via a web form on a web page?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!