Solved

How to server automatically extract zip file which uploaded from client

Posted on 2004-09-16
3
181 Views
Last Modified: 2010-03-31
My application is client/server model. I have a zip file. This zip file must be uploaded to server. How to after client upload to server successfully, server automatically extract that zip file.
0
Comment
Question by:software222
3 Comments
 
LVL 15

Accepted Solution

by:
Javatm earned 75 total points
ID: 12077408
> How to after client upload to server successfully, server automatically extract that zip file.

This 2 links can help you out, or maybe give you a nice start :

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20274744.html
http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20089536.html

Hope that helps . . .
Javatm
0
 
LVL 14

Assisted Solution

by:sudhakar_koundinya
sudhakar_koundinya earned 50 total points
ID: 12077820
try {
        // Open the ZIP file
        String inFilename = "infile.zip";
        ZipInputStream in = new ZipInputStream(new FileInputStream(inFilename));
   
        // Get the first entry
        ZipEntry entry = in.getNextEntry();
   
        // Open the output file
        String outFilename = "o";
        OutputStream out = new FileOutputStream(outFilename);
   
        // Transfer bytes from the ZIP file to the output file
        byte[] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        }
   
        // Close the streams
        out.close();
        in.close();
    } catch (IOException e) {
    }
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle SQL syntax check  without executing 6 75
throw exception 21 58
jboss wildfly 10.1 10 228
Java Eclipse Loop 3 20
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question