commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: [FileUpload] Getting wrong filename from FileItem
Date Wed, 04 May 2005 20:02:05 GMT
I know, I've run into this myself... But, it should be a fairly trivial 
exercise to write code to extract just the filename (as I believe you've 
done).  This makes sense to me as an additional method.  That way no 
existing code gets broken, but newer code can use the new method, which 
works as getName() probably should have been working all along anyway 


Dakota Jack wrote:
> The data difference is not in the code but in the request data from
> the browser.  IE puts in the full name and other browsers put in just
> the name.  Calling [file].getName() gives the same result for all of
> them.  I don't think there is a way to get a full name from the
> browsers that send only the file name.  There is no reason, of course,
> to know the full name.
> On 5/4/05, Frank W. Zammetti <> wrote:
>>It seems to me a method to get JUST the filename makes a lot of sense...
>>what has been the reason for not adding it IN ADDITION to what's there
>>now?  Unfortunately it would make more sense if getName() returned just
>>the name while there was another method, maybe getFullName() that
>>returned what getName() returns now, but that breaks existing code
>>potentially, so I can certainly see why that hasn't been done, but
>>adding something like getJustTheName() or something (obviously there
>>must be a better choice!) makes sense to me.
>>Dakota Jack wrote:
>>>That is an excellent point, Robert.  I often forget how horrible it
>>>must be to be immeshed in those programming worlds where there is no
>>>recourse.  Too often we shy away, I think, at changing code, even with
>>>the Java distribution itself, license issues notwithstanding.
>>>On 5/4/05, robert burrell donkin <>
>>>>On Wed, 2005-05-04 at 10:26 -0700, Dakota Jack wrote:
>>>>>Some people think this is a bug and some people think that this is a
>>>>>That is not a problem, however.  I just went in and changed the
>>>>>commons upload code adding .getName() to the file at this stage.  The
>>>>>problem you are seeing is in Internet Explorer, right?  Firefox and
>>>>>Netscape return the file name and Internet Explorer returns the full
>>>>>path.  Anyway, you either have to solve the problem in the commons
>>>>>upload code itself, where it is easy to solve, or to go through some
>>>>>wasted mechanisms after the fact.  Everyone has to solve this problem
>>>>>somewhere, so I definitely come down on the side of "bug" versus
>>>>the great thing about open source is that you are free to do exactly
>>>>this :)
>>>>- robert
>>>>To unsubscribe, e-mail:
>>>>For additional commands, e-mail:
>>Frank W. Zammetti
>>Founder and Chief Software Architect
>>Omnytex Technologies
>>To unsubscribe, e-mail:
>>For additional commands, e-mail:

Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message