How can the width of the textbox rendered by the @FileUpload helper be set? What would be the proper syntax? The default width is about 20 characters, if there is a long file path the file name cannot be seen in the textbox. Or if anyone knew how to have the textbox content scrolled fully to the right by default, that would be a acceptable solution.
Thanks,
Joe
@using (Html.BeginForm("Upload", "FileUpload", FormMethod.Post,
new { @encType = "multipart/form-data" }))
{ <br/>
@FileUpload.GetHtml(allowMoreFilesToBeAdded: false, initialNumberOfFiles: 1,
includeFormTag: false, uploadText: "Upload File")<br/>
<input type="submit" name="submit" value="Upload" />
}
The way the file input looks will depend on the browser you are using. You don’t even get a textbox in Google Chrome:
So talking about setting a width of this element hardly makes sense.
You may take a look at the following article which discusses the issue and possible workarounds which involve hiding the original file input (as you have no control over its presentation) and using a custom div to replace it.