Click here to Skip to main content
14,243,903 members
Rate this:
Please Sign up or sign in to vote.
See more:
In process of uploading file in, 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.
Updated 28-Apr-19 2:38am
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100