What an interesting problem...
I solved it by placing a matching text box directly over the input file text box. I disabled the above-box and set its onFocus to blur(), so that it's pretty darn difficult to disable it.
A tricky part was determining when the browser "had" the file. At that point, I would copy the contents of the file field to the text field. Mozilla/Netscape doesn't seem to operate the same as IE. So, I have it triggering from pretty much any event that made sense and gave up worrying about excess copying (I don't see the difference, practically).
Of course, you're going to have to arrange the elements as you wish. I tried briefly to force DisplayData to appear at 0-px/0-px relative to GetData (which would mean you could put GetData anywhere and DisplayData would follow it like a puppy), but I couldn't figure it out easily. Maybe someone could add that bit of info after this?
You're going to have to add your own action, of course.
Because the file window is still there (just under another field), hitting [ENTER] will still process it as you would expect with a multi-part form.
Here's my listing. It works under IE and Mozilla. It passes the validation at W3C, too.
Code:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></meta>
<title>JavaScript Sample</title>
</head>
<body>
<form name="ThisForm" enctype="multipart/form-data" method="post" action="">
<p>Please choose a file</p>
<div id="GetData" style="position: absolute; left 10px; top: 40px;"><input type="file" name="GrabbaFile" size="60" onchange="ThisForm.FileHolder.value=ThisForm.GrabbaFile.value;" onclick="ThisForm.FileHolder.value=ThisForm.GrabbaFile.value;"></input></div>
<div id="DisplayData" style="position: absolute; left 10px; top: 40px;"><input type="text" size="60" name="FileHolder" onfocus="ThisForm.FileHolder.blur();return false;" disabled="disabled"></input></div>
</form>
</body>
</html>
Cheers,
![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)
Edward
"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door