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

Free6

Newbie
Joined
Nov 21, 2016
Messages
47
Reaction score
1
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.

Code:
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
                SelectFile()
                file.InvokeMember("Click")
            End If
        Next
    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

940226
 
Back
Top