Solved

How to server automatically extract zip file which uploaded from client

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
map related example 6 47
fibonacci ten numbers 4 38
hibernate example issues from command prompt 10 40
String array comparison 4 32
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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.

776 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