You could simulate Firefox behavior as follows:
<input type="file" name="test" onkeypress="this.click();return false;">
When the user tries to enter a file input, he displays a selection file.
Obviously, this will not work if the client has JavaScript disabled, but depending on your requirements, it may be "good enough."
There is an opportunity to work in IE 6, 7 and 8.
It works fine in Firefox 3 (since it doesn't allow typing on <input type=file> ).
It works fine on Safari for Windows 3 and 4 (since it doesn't allow printing to <input type=file> ).
In Opera 9 (which allows you to enter text <input type=file> ), it does nothing (does not pop up the selection or swallow keystrokes). The onkeypress event does not seem to fire at all, possibly for security.
In Firefox 2, it does not work (which allows printing to <input type=file> ), because this.click() does not expose the this.click() , and return false swallows keystrokes.
Grant wagner
source share