Solved

How to server automatically extract zip file which uploaded from client

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
use lov values 2 71
ejb example issues 3 47
How do I remove an object from a 3 51
hashmap order 17 40
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

679 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