| 
	
 | 
 Posted by Jukka K. Korpela on 12/13/06 21:33 
Scripsit jonesy <3: 
 
> Hi All, 
 
Who's All and why should we know him? Please start with a quote or  
paraphrase in the future, to give context. 
 
> The purpose for retrieving the filename from a form: 
 
You could have saved everyone's time, especially yours, by starting with a  
description of the original problem rather than assumed solution, which is -  
surprisingly - not a completely dead end, though tricky, slippery, and  
unnecessary complex. Any recognition of the "file name" from the form data  
is heuristic at best, and usually pointless. 
 
> I have a database that stores the file name. 
 
Which "the" file name? The file name of the input file, if any (there's no  
law against browsers supporting file input that is not taken from a file at  
all), should almost always be immaterial to the processing of the form data.  
Sometimes you could consider using it as a name for something that you store  
on the server, but what would do, for example, with a file name containing  
only Chinese characters? 
 
So it's much better to prompt the user for some suitable name to be used for  
the file on the server, or for the data to be entered in a database. 
 
> This filename is taken 
> by a java servlet which displays a link to the file on the website. 
 
This would result in interesting situations if the filename contains  
non-ASCII characters, wouldn't it? It could contain them even if it were  
direct user input, but then you would probably more easily remember to  
_check_ the input for acceptability and to prompt for a new name if needed. 
 
So just add a text input field for the file name (or data set name, or  
whatever you call it), or generate a name with some algorithm if it need not  
be mnemonic. 
 
--  
Jukka K. Korpela ("Yucca") 
http://www.cs.tut.fi/~jkorpela/
 
[Back to original message] 
 |