Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 28-Apr-19 2:38am
v2
Comments
Kornfeld Eliyahu Peter 5-May-19 6:12am    
Have you checked Chrome's debugger for possible error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900