Problem with uploading ZIP files..........through servlet using a java client...

Posted on 2004-08-19
Medium Priority
Last Modified: 2010-05-18

i am trying to upload a Zip file from a client program through a Servlet. I am able to upload but the files are correpted. I checked the size of the uploaded file. its same as the orginal file.. i dont know what's the problem..  following is the code in my servlet that reads the file and saves

       BufferedReader buffRead = new BufferedReader(new InputStreamReader(InStream));
       DataOutputStream dos = new DataOutputStream(new FileOutputStream(sFileName));
       int i;
       while ((i = buffRead.read())!=-1)
       {   dos.write(i);

Any suggessions pls.. and one more thing if I try this for text files then its uploading fine...

thanks in advance
Question by:ekartha
  • 2
LVL 35

Accepted Solution

TimYates earned 500 total points
ID: 11838677
Don't read it with a Reader

Readers are for text files :-/

Change "BufferedReader" to "BufferedInputStream", like:

       BufferedInputStream buffRead = new BufferedInputStream( InStream );

(and make sure you close them in a finally block)

LVL 35

Expert Comment

ID: 11839563
Did it work?  Cool :-)

Good luck with it!!!


Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In computing, Vulnerability assessment and penetration testing are used to assess systems in light of the organization's security posture, but they have different purposes.
Configure external lookups on for external mail flow on Exchange 2013 and Exchange 2016.
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
If you are looking for an automated tool which can generate reports for Outlook emails and other items from PST file, then you can go for Kernel PST Reporter tool. The reports which are created by this tool are helpful to analyze and understand PST …

619 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