Mark Kadlec
Mark Kadlec

Reputation: 8460

How can I populate the textbox of an HTML file input?

This one has got me stumped. I am currently rendering a form using ASP MVC, it has a bunch of fields, one of them is an <input type="file"...

The file upload works great, but when I return the form to the user, the textbox that contains the file is empty. I would like to show the filepath in the textbox, but it appears the value field does not populate this textbox.

Ie. <input type="file" value="abc.txt" /> does not put "abc.txt" into the textbox.

How can I populate the textbox of an HTML file input? Is there another property that I should be using other than the value property?

Any help would be much appreciated,

Upvotes: 1

Views: 1509

Answers (1)

amurra
amurra

Reputation: 15411

That textbox is readonly and you can't explicitly set the value of it.

Upvotes: 5

Related Questions