Return-Path: Delivered-To: apmail-jakarta-turbine-user-archive@jakarta.apache.org Received: (qmail 73317 invoked by uid 500); 17 Oct 2001 15:42:19 -0000 Mailing-List: contact turbine-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: turbine-user@jakarta.apache.org Delivered-To: mailing list turbine-user@jakarta.apache.org Received: (qmail 73291 invoked from network); 17 Oct 2001 15:42:18 -0000 From: "C Mason@ Intechtual" To: Subject: RE: FileItem - write method error.... Date: Wed, 17 Oct 2001 10:37:51 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Importance: Normal In-Reply-To: <20011017114400.58827.qmail@web20706.mail.yahoo.com> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N I had encountered the same problem with .gif files. It only occurs in "in memory" files. I traced the problem back to the string encoding corrupting the binary data. Here's my fix: public void write(String file) throws Exception { if (inMemory()) { //FileWriter writer = new FileWriter(file); FileOutputStream writer = new FileOutputStream( file ); //writer.write(getString()); writer.write( this.get () ); writer.close(); } else if (storeLocation != null) { /* * The uploaded file is being stored on disk * in a temporary location so move it to the * desired file. */ if (storeLocation.renameTo(new File(file)) == false) { throw new Exception( "Cannot write uploaded file to disk!"); } } else { /* * For whatever reason we cannot write the * file to disk. */ throw new Exception("Cannot write uploaded file to disk!"); } } Hope this helps, Chris Mason cmason@intechtual.com -----Original Message----- From: Ling Kok Choon [mailto:kokchoon78@yahoo.com] Sent: Wednesday, October 17, 2001 6:44 AM To: turbine-user@jakarta.apache.org Subject: FileItem - write method error.... Hi, I use turbine upload service to upload file to server, but i face some error when upload files by using write method. The error is not consistent, some files like flash, and picture file will corrupt when upload to server. the upload service setting at the TurbineResuouces.properties is : services.UploadService.automatic=true # # The directory where files will be temporarily stored. # services.UploadService.repository=. # # The maximum size of a request that will be processed. # 2.5 mb # services.UploadService.size.max=2621440 # # The maximum size of a request that will have it's elements cached in # memory by TurbineUploadService class. # services.UploadService.size.threshold=10240 Is the setting above valid ? and the system available physical memory is only 68343K, is it the cause of this error , or others ? Thank you. regards, kok choon __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: turbine-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: turbine-user-help@jakarta.apache.org