6
Answers

FileUpload - ImageButton - FilePath on ImageButton

Kavi suja

Kavi suja

11y
2.4k
1
Hi,
   I use Imagebutton as FileUpload Control using the following code.When i click on image,the popup for choosing file from local system will be shown.

<head runat="server">
  <title></title>
  <script type="text/javascript">
  function chooseFile() {
  document.getElementById("FileUpload1").click();
  }
  </script>
</head>
<body>
  <form id="form1" runat="server">
  <div>
  <div style="height: 0px; overflow: hidden">
  <asp:FileUpload ID="FileUpload1" runat="server" />
  </div>  
   <asp:ImageButton ID="ImageButton1" runat="server" OnClientClick="chooseFile();" ImageUrl="btnlogin.png" />
  </div>
  </form>
</body>
</html>



Now I want to display the path of the selected file on imageButton after the file selected.Can anyone help me to do this?
Answers (6)