----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

--- Greg Purpura <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I have a servlet that can accept file uploads. Based
> on quite a bit of
> logging & experimenting, I found that if the entire
> file is not read all at
> once, the following exception is being thrown in my
> read loop:
> 
>       //open input stream from client to capture
> upload file
>       inn = new
> DataInputStream(request.getInputStream());
>       int formDataLength = request.getContentLength();

Er, have you tried using
com.oreilly.servlet.MultiPartRequest? 

Check out 

http://www.servlets.com/resources/com.oreilly.servlet/index.html

JSDK 2.0 doesn't have a direct implementation of RFC
1867 File Uploads, AFAIK. If you used that, you
wouldn't need to frob through the request yourself.

Let us know what you find out.

>       int bytesRead = 0;
>       int totalBytesRead = 0;
>       int sizeCheck = 0;
> 
>       //2nd iteration here always causes exception below
>        while (totalBytesRead < formDataLength) {
>          bytesRead = inn.read(dataBytes,
> totalBytesRead, formDataLength);
>          totalBytesRead += bytesRead;
>          }

You might / should turn off JIT when you are in
development so that you get line numbers in your stack
traces.
 

=====
# Nick Bauman
# Technical Programmer
# http://webhelp.com
# real people, real answers, real time
__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping: http://shopping.yahoo.com


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to