How I can Upload File with WebBrowser??
Y have a inputBox and a Button in a website and i if I press the button opens a CommonDialog me to scan the file and put the route on the input ...
this has to be very easy
Thanks
Printable View
How I can Upload File with WebBrowser??
Y have a inputBox and a Button in a website and i if I press the button opens a CommonDialog me to scan the file and put the route on the input ...
this has to be very easy
Thanks
Use the PostData Parameter.
It's simple AND elegant
From THE MSDN
Hope this helpsCode:Sub Command1_Click()
Dim URL As String
Dim Flags As Long
Dim TargetFrame As String
Dim PostData() As Byte
Dim Headers As String
URL = "http://YourServer" ' A URL that will accept a POST
Flags = 0
TargetFrame = ""
PostData = "Information sent to host"
' VB creates a Unicode string by default so we need to
' convert it back to Single byte character set.
PostData = StrConv(PostData, vbFromUnicode)
Headers = ""
WebBrowser1.Navigate URL, Flags, TargetFrame, PostData, Headers
End Sub
mmmm
Thanks but I've been looking and can not find what I wanted ... :(
This is the code of the web with the need to interact:
Y use this but it doesn't works:Code:<input type="file" name="archivo" id="idarchivo">
<br>
<br>
<input type="submit" name="enviar" value="Submit-enviar" onclick="alert('ok1')">
<br>
<br>
What am I doing wrong? :confused:Code:WebBrowser1.Document.All("archivo").Value = "C:\File.txt"
WebBrowser1.Document.All("enviar").Click
Thanks!:afrog:
afaik you can not automate a file input
@_-Rs-_
It works!! ;)
Thanks, but are you sure it's the best way to do it?? :confused:
So I can't do otherwise than with SendKeys?
Thanks again :D
Well bro it's true SendKeys has lot of issues may not be reliable at all
But it's up to you what functions or controls you prefer to use :bigyello:
But there are other ways to do this aswell like using winsock , Inet ect..
Or using other VB functions :afrog:
EDIT: Dont forget to mark the thread as SOLVED :check: if you found what your looking for :wave:
Thanks! :afrog:
RESOLVED :check: