[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File Upload through Servlet problem



Try doing a ServletInputStream.readLine() and cut off
the \r\n off of the end of each line.  This worked for
me and ensured a byte-for-byte transfer.  Also, check
out the MultiPartParser by Jason Hunter
(http://www.servlets.com/cos/index.html).  It will do
all of the leg work addition to error checking, file
saving, etc.  It will do all of the work for you by
just passing in the request and a few other pieces of
information.

Robert

--- blaine_mincey@mindspring.com wrote:
> Hi all.  My co-worker is experiencing a strange
> problem.  He is trying to do a 'simple' file upload
> through a servlet.  The following code does the
> trick using Internet Explorer both http and https
> but on Netscape it only works through http.  Using
> https on Netscape it always cuts off the last
> several bytes of the file making it corrupt.  Does
> anyone have any ideas?  Code snippet follows.
> 
> Thanks in advance.
> 
> Blaine
> 
> StringBuffer sb = new StringBuffer();			
> ServletInputStream in = request.getInputStream();	
> int i = in.read();
> while (i != -1) 
> {		
> 	sb.append((char)i);
> 	i = in.read();
> }
> out.println(sb.toString());
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/