commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <mart...@apache.org>
Subject Re: [FileUpload] The getName method yields inconsist value
Date Tue, 06 May 2003 00:33:04 GMT

"Vernon" <vernonw@gatewaytech.com> wrote in message
news:oprop4o8sxvu4si3@mail.bluesoft.ca...
>
> I just find the method returns a file name with Opera 10.7 and a full path
> of a file with IE 5.0. I would like to confirm that is not a desired
> behaviour. The version of the fileupload package I use is 1.0-dev, build
> 05-03. I use a newer API: DiskFileUpload. I don't see any stable build
with
> the API other than a night build.

FileUpload is giving you the file name as the browser provided it, so the
fact that you are seeing different behaviour across browsers is because the
browsers themselves behave differently in this regard. The file upload spec
(RFC 1867) is silent on this.

The DiskFileUpload API is the right one to use. It was recently added, but
will become part of Beta 2 as soon as I can get that done.

>
> Also, how to use the new write method with attribute file? I can't see how
> a file instance can be constructed within the content.

I'm not sure I understand what you mean. If you had this before:

String newFile = "C:\\temp\\upload.dat";
item.write(newFile);

you would just do this now:

File newFile = new File("C:\\temp\\upload.dat");
item.write(newFile);

Passing a File to write() allows you to do the same as you would have done
before, but it also allows you to work with paths and files without having
to mess with separators, amongst other things.

--
Martin Cooper


>
> -- 
> Vernon




Mime
View raw message