I want to download multiple files (file is in zip format ) from server to client machine to specific path with unzip format please give me the code for it.........
please tell me.......
(Technology : JSP)

Recommended Answers

All 9 Replies

Hello
I am new in java ...So
I want to download multiple files (file is in zip format ) from server to client machine
specific path within unzip format please help me .........
please I am not student ,I am a software professional.. .......
please help me....
please...
Framework: JSP
Email Id: <EMAIL SNIPPED>

please I am not student ,I am a software professional.. .......

So then you should have some idea of what you need to do, and if not, you should have some idea of how to figure it out. If you don't that's not saying much for your being a "software professional".

Do some research (you can find all you need with one single, simple, google search), give it try, and post that back here with a real question, any, and all, error/compiler messages, and/or a complete, but concise, descritpion of the difference between the expected and the actual results.

So because you been told of to do some search and come asking specific questions and not generic stuff you have right to create new thread?
No you do not have that right. Both threads been merged now!

please I am not student ,I am a software professional.. .......
please help me....
please...

Boasting that you are professional wouldn't help either...

Whether you are professional or student is irrelevant. The fact that you are new in Java means that this is too much for you. No one that is new in Java can deliver what you have been asked to do. What you have been asked is not for beginners.

I am not the best in java but not a beginner either. But I don't know how to do this and if I had to, I would do a lot of search and studying. There are many examples and tutorials and libraries that do what you want with little code and effort on your behalf.

Start searching and coding.

I write code to download zip files with exatcting all files in it. but it download only one file with extracing so please tell me changes in following code to download all files from zip files with extracting.


please help me.........

<% 
 final int BUFFER = 50048;
 String zipfile="C:\\"+"Data.zip";
      String dwFilename =zipfile;
      response.addHeader("Content-Disposition","attachment; filename="+dwFilename );
      // set the http content type to "APPLICATION/OCTET-STREAM
      response.setContentType("APPLICATION/OCTET-STREAM");

     // initialize the http content-disposition header to
     // indicate a file attachment with the default filename
     BufferedInputStream buf=null;
     ServletOutputStream myOut=null;
     myOut = response.getOutputStream();
     
     byte[] buf1 = new byte[5024];
     ZipInputStream zipinputstream = null;
     ZipEntry zipentry;
     zipinputstream = new ZipInputStream(new FileInputStream(zipfile));
     zipentry = zipinputstream.getNextEntry();
      while (zipentry != null) {
      String entryName = zipentry.getName();
      FileOutputStream fileoutputstream;
      File newFile = new File(entryName);
      String directory = newFile.getParent();

      if (directory == null) {
        if (newFile.isDirectory())
          break;
      }
      //fileoutputstream = new FileOutputStream(destinationname + entryName);
      int n;
      while ((n = zipinputstream.read(buf1, 0, 1024)) > -1){
        //fileoutputstream.write(buf, 0, n);
          myOut.write(buf1,0,n);
      }
     // fileoutputstream.close();
      zipinputstream.closeEntry();
      zipentry = zipinputstream.getNextEntry();
      myOut = response.getOutputStream();
       myOut.close( );
    }
    zipinputstream.close();
  %>

@pradeeppatil110 you better start reading rules!

Keep It Clear

Do wrap your programming code blocks within [code] ... [/code] tags

Keep It Organized

Do not post the same question multiple times

I write code to download zip files with exatcting all files in it. but it download only one file with extracing so please tell me changes in following code to download all files from zip files with extracting.

Uhm, put it in a loop?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.