Hi everyone,
I have been trying to change my browse button appearance displayed with my
HtmlInputFile control but without any success. The solution I tried was the
one discuss on this forum (http://p2p.wrox.com/topic.asp?TOPIC_ID=4772).
Here is my code:
<script language="JavaScript" type="text/javascript">
function HandleFileButtonClick()
{
document.frmUpload.myFile.click();
document.frmUpload.txtFakeText.value =
document.frmUpload.myFile.value;
}
</script>
<!-- Real Input field, but hidden-->
<input type="file" id="myFile" style="display: none" runat="server">
<!-- Fake field to fool the user -->
<input type="text" name="txtFakeText" readonly="true">
<!-- Button to invoke the click of the File Input -->
<input type="button" onclick="HandleFileButtonClick();" value="Upload
File" style="background: red;">
<asp:RequiredFieldValidator id="val_Input"
ControlToValidate="myFile" Display="Dynamic"
errormessage="Error" />
My problem is that my HTMLInputFile text is always empty and therefor, my
RequiredFieldValidator fells.
Any help, tips, code, other suggestions, site is greatly appreciated.
Jonathan