Solved

How to server automatically extract zip file which uploaded from client

Posted on 2004-09-16
3
178 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now