In process of uploading file in asp.net, if fileUpload control is called from a button click in chrome browser, the file path and name is not saved and the "onchange" event is not triggered.
Works fine in IE. Following is the design and code in vb.
and for some reason not known to me, if i put a breakpoint on code of adding attribute of upload button, the system works.
Their must be some work around for this issue dealing in chrome. Please advise..
<asp:Button ID="btnUpload" runat="server" Font-Size="10pt" Text="Select file" CssClass="buttonbrown"/>
<asp:FileUpload ID="fuAttachment" runat="server" onchange="FileUploadPostBack();" type="file"
style="width:0px;display:none;" />
<asp:Button ID="btnConfirm" runat="server" Font-Size="10pt" Text="Confirm file/s" OnClick="btnConfirm_Click"
style="visibility: hidden; display: none;" />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'To make active file upload on click of Add attachments button so to keep file upload invisible
btnUpload.Attributes.Add("onclick", "document.getElementById('" + fuAttachment.ClientID + "').click()")
'To auto upload on selection of file in fileupload by calling click event of button for upload
Dim jscript As String = "function FileUploadPostBack(){" + ClientScript.GetPostBackEventReference(btnConfirm, "") + "};"
Page.ClientScript.RegisterClientScriptBlock(Me.[GetType](), "Key", jscript, True)
end sub
What I have tried:
Have tried many options suggested on internet. This is a known issue of chrome not saving the file name but no clear remedy was found.