Page 1 of 1

File input

Posted: Sat Jul 16, 2011 11:05 am
by gille
Hello,

There is a webpage with a file input.
How can I put a file in the input with VB?

gille

Re: File input

Posted: Sat Jul 16, 2011 4:32 pm
by CodenStuff
Populate the file input box on a webpage with the location/filename you wish to upload?

Using a webbrowser control and knowing the file input element ID on the page you could do something like this:
Code: Select all
Dim Element As HtmlElementCollection = WebBrowser1.Document.All
        WebBrowser1.Document.GetElementById("FileInputElement").SetAttribute("value", "C:\MyFileToUpload.zip")
        
If you struggle with that code please post back with the webpage url which contains the file input box your trying to fill in and I will see if I can get you the code for it.

Hope that helps cooll;

Re: File input

Posted: Sat Jul 16, 2011 5:02 pm
by gille
Thanks, but an input field hasn't a value-attribute.
I would like to upload a file on 2shared: http://www.2shared.com/