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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to