-
Feb 5th, 2010, 09:46 PM
#1
Thread Starter
Fanatic Member
How do I post data in webbrowser1 ?
I'm using this to post data to my server from my vb6 app I post data fine but i can't send a image to my server I work fine on my website "on a html page" and upload the image to my server with out problem but i would like to do it from my app. here my v6 code
Private 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://myserver.com/" ' A URL that will accept a POST
Flags = 0
TargetFrame = ""
PostData = "function=pic2&username=jct&password=ram4&pict=temp.gif&pict_to=0&pict_type=0"
PostData = StrConv(PostData, vbFromUnicode)
Headers = "Content-Type: application/x-www-form-urlencoded" & _
vbCrLf
WebBrowser1.Navigate URL, Flags, TargetFrame, PostData, Headers
End Sub
here my html code
<html>
<head>
</head>
<body>
<form
method="POST"
action="http://mywebserver.com/"
enctype="multipart/form-data">
<input type="hidden" name="function" value="pict2">
<input type="text" name="username" value="jct">
<input type="text" name="password" value="ram4">
<input type="file" name="pict">
<input type="text" name="pict_to" value="0">
<input type="text" name="pict_type" value="0">
<input type="submit" value="Send" id="upload pic">
</form>
</body>
</html>
so basically I want my vb6 app to do what this html page .
Live life to the fullest!!
-
Feb 6th, 2010, 04:17 PM
#2
Thread Starter
Fanatic Member
Re: How do I post data in webbrowser1 ?
anyone? is this possible to post a image using the webbrowser control?
Live life to the fullest!!
-
Sep 12th, 2017, 11:03 AM
#3
Re: How do I post data in webbrowser1 ?
Originally Posted by newprogram
anyone? is this possible to post a image using the webbrowser control?
IT's not that easy... and it's not that easy for a reason... If it was then anyone could create a website, then create an app with a WB and scrape files off anyone's computer w/o them knowing. It would be a security nightmare. Your value for pic in the post data is incorrect. It isn't going to be the file name... it would actually be the file itself. But again it's not that simple, as there's other data to go along with it: name, size, etc. But... I don't think it's possible to post a file in the first place like this because it would be a security issue if you could... I also think that's the wrong content type header to use when posting files. Not sure though.
-tg
-
Sep 12th, 2017, 07:10 PM
#4
Fanatic Member
Re: How do I post data in webbrowser1 ?
WebBrowser is a browser and browsers do not upload data to a website unless there is some application on the server to allow uploading in which case it is not the browser that does the uploading. I'm assuming the website is your website so if it is then consider using FTP to upload.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|