FileUpload should not be in the business of deciding, on behalf of its
client, how to interpret the content of fields uploaded by the browser.
Its function is to parse the request into fields which can be accessed by
the client, and it is up to the client to decide how to process those
fields.

In particular, FileUpload is not a browser compatibility layer, and I, for
one, am not interested in incorporating this type of functionality. To do
so is to make potentially invalid assumptions about what the client wants
of it.

--
Martin Cooper


On Sat, 28 Jun 2003, maciek wrote:

> Method getName() in DefaultFileItem.java class when used with
> msiexplorer 5/6 returns a filename with the whole client's filesystem
> path which creates a problem when you want to save the file on a
> server's filesystem. I have chanaged the implementation of the getName()
> method to strip the path information from the filename.Below is my
> proposed implementation for getName() method:
>
> public String getName()
>     {
>
>          if(fileName.lastIndexOf("\\") != -1){
>
>               return fileName.substring(fileName.lastIndexOf("\\") + 1);
>
>          }else{
>
>               return fileName;
>          }
>     }
>
> I have attached the fileName_fix_forMSIE.txt patch file.
>
> I have rebuild the entire source code to create a new jar and tested it
> with Tomcat and Resin. It works now with MSIE. A simple call to
> item.getName() returns only filename where item is of type FileItem.
>
> I think that it would be a better idea to change the implementation of
> the method without breaking of the FileUpload component interface than
> letting web developers to take care of the problem inside a jsp file.
> I think users of the component should use the method transparently
> without worrying about the possible problem with MSIE with the guarantee
> that ONLY filename will be returned from getName() method.
> Regards,
> Maciej Brodala
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to