Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 84997 invoked from network); 19 Jun 2003 11:02:02 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 19 Jun 2003 11:02:02 -0000 Received: (qmail 18447 invoked by uid 97); 19 Jun 2003 11:04:20 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 18440 invoked from network); 19 Jun 2003 11:04:20 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 19 Jun 2003 11:04:20 -0000 Received: (qmail 83538 invoked by uid 500); 19 Jun 2003 11:01:47 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 83525 invoked from network); 19 Jun 2003 11:01:46 -0000 Received: from sid.armstrong.com (204.74.20.252) by daedalus.apache.org with SMTP; 19 Jun 2003 11:01:46 -0000 Received: from joedog.org (fnord.armstrong.com [204.74.20.11]) by sid.armstrong.com (8.12.8p1/8.12.8) with ESMTP id h5JAuHM0025993 for ; Thu, 19 Jun 2003 05:56:17 -0500 Message-ID: <3EF19810.2070806@joedog.org> Date: Thu, 19 Jun 2003 07:01:36 -0400 From: Tim Funk Organization: Human being User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en, es-mx, de, sv MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Problem with binary HTTP 1.0 POST References: <005301c33635$d8bedee0$6401a8c0@gus> In-Reply-To: <005301c33635$d8bedee0$6401a8c0@gus> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N read() may also return 0 or -1. -1 for end of file. Also the implementation of read is done that subsequent reads also return -1. Also make sure your posting byte calculation is correct. Problem code: > int bytesRead = inStream.read(inData); > fileOutStream.write(inData, 0, bytesRead); > totalBytesRead += bytesRead; Alternative: ... int contentLength = request.getContentLength(); InputStream inStream = request.getInputStream(); FileOutputStream fileOutStream = new FileOutputStream("SomePhoto.jpg"); byte[] inData = new byte[100]; int totalBytesRead = 0; int bytesRead = inStream.read(inData); while(bytesRead>=0 && totalBytesRead