?
Solved

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

Posted on 2004-08-19
2
Medium Priority
?
214 Views
Last Modified: 2010-05-18
hi

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);
       }        
       buffRead.close();
       dos.close();

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

thanks in advance
0
Comment
Question by:ekartha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 35

Accepted Solution

by:
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)

Tim
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11839563
Did it work?  Cool :-)

Good luck with it!!!

Tim
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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
The well known Cerber ransomware continues to spread this summer through spear phishing email campaigns targeting enterprises. Learn how it easily bypasses traditional defenses - and what you can do to protect your data.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

770 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