1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to upload a File in Web Form without poping up Browser dialog

Discussion in 'Visual Basic .NET' started by Free6, Nov 24, 2016.

  1. Free6

    Free6 Newbie

    Nov 21, 2016
    Likes Received:
    Hi, I would like to know how to do to upload a File (picture) in Web Form without poping up the Browser For File Dialog,
    So I mean SILENTLY upload a File (picture) in Web Form in (INPUT type="File") tag.

    I have the below solution but that solution pops up the "Browser For File" dialog whereas the application will run automatically, so having that dialog to popup every time it's not really nice and it disturbs the process, that's why I need to upload the file at the background.

    In brief, I don't want the "Browse For File" dialog to be shown.

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim elements As System.Windows.Forms.HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input")
            For Each file As HtmlElement In elements
                If file.GetAttribute("name") = "u" Then
                End If
        End Sub
        Public Async Sub SelectFile()
            Await Task.Delay(2000)
            SendKeys.Send("Put your file’s name here." + "{ENTER}")
        End Sub
    Tag to upload the picture