users@glassfish.java.net

Re: servlet 3.0_at_glassfish v3 - fileUpload completely broken?

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 14 Apr 2010 12:41:42 -0700

Dominik Dorn wrote:
> thx alexis, very kind of you ;)
>
> Well, it's not working 100% correctly IMO... if I'm using the following code
> String newFileNamePath = "/home/domdorn/skriptum/upload/" +
> hash.toString();
> File f = new File(newFileNamePath);
> f.createNewFile();
> part.write(newFileNamePath);
>
> it appends newFileNamePath to the path where the file is currently
> stored instead
> of an absolute path, creating a Path like
> /home/domdorn/tmp/glassfish/release/glassfishv3/glassfish/domains/domain1/generated/jsp/skriptum/home/domdorn/skriptum/upload/48ce07c5-75d4-4483-9dc9-f92036eb685e
>
> which then leads to a java.io.FileNotFoundException, because it could
> probably create the file but not the parent-directories
>
>
> I think this is a bug, whose with me?
>

I think this is expected, as per the javadocs of
javax.servlet.http.Part#write:

     * @param fileName the name of the file to which the stream will be
     * written. The file is created relative to the location as
     * specified in the MultipartConfig


Jan

> thanks,
> dominik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>