hi Chris,
You cannot reflect the style properties set on the INPUT element or change
the text on the Browse button, but there is a way to get most of the
functionality you need. First, you'll need to actually use a file upload
element for both its browsing and uploading abilities. Next you'll have to
add your own button and text field to the page. Then, to tie them together,
you'll have the button's onClick event trigger the click method of the file
upload element and the onChange event of the file upload element set the
value of the text field. Then, you can customize the appearance of the
button and text field as usual. Here's a sample:
<INPUT TYPE="file" ID="filUpload" STYLE="display:none"
onChange="txtFilename.value = this.value;">
<asp:input runat="server" ID="txtFilename"
STYLE="FONT-FAMILY:Tahoma;FONT-SIZE:9pt"
SIZE="25" DISABLED>
<INPUT TYPE="button" ID="btnBrowse" STYLE="FONT-FAMILY:Tahoma;FONT-SIZE:9pt;
BACKGROUND-COLOR
eachpuff" onClick="filUpload.click()"
VALUE="Choose a File">
However theres a catch. Because of the file upload element's security
restrictions, this workaround does not allow the user to change the location
of the file to be uploaded simply by editing the value of the text field
which is why its DISABLED attribute is set.
Christopher Attard said:
Hello,
I'm using an <input type=file> control in an asp.net page and I
need to change the text of the "Browse..." button cos the page needs to be
multi-lingual.