3

Is there a way to change the text on a a file input in html?

Brian
  • 26,662
  • 52
  • 135
  • 170
  • In google chrome, it says Choose File on the button and tehn no file selected next to it. Can I customize these? – Brian Feb 11 '10 at 04:49
  • You could create a hack like placing an absolute div over the file field or assigning a file field action to a text input field. – james_womack Feb 11 '10 at 04:51

3 Answers3

2

This is the only possible solution i know of.

Sarfraz
  • 377,238
  • 77
  • 533
  • 578
0

There are two ways.

Javascript

Flash

through javascript + css hack, you can do this as @Sarfaraz said. Another option is use flash. In that case you have more control.

Adeel
  • 19,075
  • 4
  • 46
  • 60
0

That's not possible. That would have been a security hole. If that was possible, then everyone would be able to do this:

<form name="upload" action="upload" method="post" enctype="multipart/form-data">
    <input type="file" value="c:/passwords.txt">
    <input type="submit">
</form>
<script>document.upload.submit()</script>

True, you can mimic it with a plain input field as @sAc mentions, but it would still not point to the actual file.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555