Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 39155 invoked from network); 18 Mar 2008 03:19:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Mar 2008 03:19:04 -0000 Received: (qmail 53535 invoked by uid 500); 18 Mar 2008 03:18:59 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 53449 invoked by uid 500); 18 Mar 2008 03:18:59 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 53438 invoked by uid 99); 18 Mar 2008 03:18:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Mar 2008 20:18:59 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of joerg.heinicke@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 18 Mar 2008 03:18:11 +0000 Received: (qmail invoked by alias); 18 Mar 2008 03:18:31 -0000 Received: from c-76-116-243-84.hsd1.pa.comcast.net (EHLO c-76-116-243-84.hsd1.pa.comcast.net) [76.116.243.84] by mail.gmx.net (mp037) with SMTP; 18 Mar 2008 04:18:31 +0100 X-Authenticated: #3483660 X-Provags-ID: V01U2FsdGVkX19SvE03Um9SiG4oYjJUhyuGr8WinietOAG/VUBEmh /U9YyZiT947nQ7 Message-ID: <47DF3486.4040309@gmx.de> Date: Mon, 17 Mar 2008 23:18:30 -0400 From: Joerg Heinicke User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.12) Gecko/20080201 SeaMonkey/1.1.8 MIME-Version: 1.0 To: users@cocoon.apache.org Subject: Re: upload widget References: <47DBD422.1020500@didm.co.uk> <47DDAC36.1010704@tuffmail.com> <47DE3C29.40604@didm.co.uk> <47DE7F9E.7040800@apache.org> In-Reply-To: <47DE7F9E.7040800@apache.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked by ClamAV on apache.org On 17.03.2008 10:26, Felix Knecht wrote: >> part.copyToFile("new.pdf") ; > > I don't think that 'part' implements a the function 'copyToFile' (at > least I haven't found it). It is, but not really in a useful way: public void copyToFile(String filename) throws IOException { InputStream is = getInputStream(); OutputStream os = new FileOutputStream(filename); IOUtils.copy(is, os); is.close(); os.close(); } So the file is created relative to the JVM's base directory which is for Tomcat the bin directory in CATALINA_HOME (when started via the batch files in that directory). I'd rather recommend to use absolute filenames or copyToSource(Source) and resolve the path you want to write to beforehands. Also the above is a rather buggy implementation, there is no guarantee the streams are closed. Joerg --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org