Clearing File Upload Control with the help of Javascript.

vishalneeraj-24503
Posted by vishalneeraj-24503 under JavaScript category on | Points: 40 | Views : 1034
Sometimes,it's needed to clear Fileupload control,so that it would not be uploaded again and again.So,we can do this with Javascript function as shown below:-

<script language = "javascript">
function Clear_FileUpload()
{
var flu_pd = document.getElementById("fle_upd_documents");
flu_pd.select();
var val = flu_pd.createTextRange();
val.execCommand('delete');
flu_pd.focus();
}
</script>
<asp:FileUpload ID = "fle_upd_documents" runat = "server" />
<asp:Button ID = "btn_upload" runat = "server" OnClientClick = "Clear_FileUpload()" Text = "Upload" />

Comments or Responses

Login to post response