|
-
Aug 7th, 2001, 11:23 AM
#1
Thread Starter
Addicted Member
filing out the form to a hidden webpage.
Ok, I need to use http to upload files. I have tried many times with the inet control. But it refuses to work. So I was wondering. How would I go about filing out the form of a form to a hidden webcontrol page?
I need to do it to send data to a linux server for processing and stuff. But I'm new to vb and have to clue how to go about this. An example would be nice also if possable..
-
Aug 7th, 2001, 11:35 AM
#2
PowerPoster
I don't understand what u are asking?
-
Aug 7th, 2001, 11:42 AM
#3
Thread Starter
Addicted Member
I want to fill out a web form (using the webcontrol) and send it out. I just noticed someone asked the same question, and was wondering if this would work now..
Code:
Private Sub cmdSubmit_Click()
WebBrowser1.Navigate "http://www.vi2.com/cgi-bin/uploadMF"
Do
DoEvents
Loop Until Not WebBrowser1.Busy
With WebBrowser1.Document
.All("name").Value = "Whatever"
.All("comment").Value = "whatever"
.All("info").Value = "whatever"
.All("email").Value = "whatever"
.Forms(0).submit
End With
End Sub
-
Aug 7th, 2001, 11:43 AM
#4
Frenzied Member
Dr.Sparkle -
Can you post the URL of the web-page that your trying to work with?
Edit: Whoops we must have cross-posted...I see your code now.
-
Aug 7th, 2001, 11:55 AM
#5
Thread Starter
Addicted Member
This is the webpage..
http://www.vi2.com/maxForumFiles/
We will be adding more features soon. Like name, e-mail, saved config for later deletion and stuff. It will all be added to a db backend..
That's why it nly has a description field right now..
-
Aug 7th, 2001, 12:06 PM
#6
Fanatic Member
Crash course in HTTP Protocol
Your best option is to get low down and dirty with the HTTP Protocol... 
If you need to upload form data to an HTTP server, there are two options available: POST and GET.
Post is preferred, as the data isn't stored in the URL as with GET... POST also supports the upload of files... The following examples detail how you would go about uploading form information...
Example of using HTTP GET Method
Code:
'Assumes Form fields named txtName and txtEmail
strData = "GET /Data.cgi?txtName=Digital+X%2DTreme&txtEmail=digital%5Fx%[email protected] HTTP/1.1" & vbCrlf
strData = strData & "ADDITIONAL HTTP HEADER INFO" & vbcrlf & vbcrlf
'Connect to HTTP Server, then send
Winsock.SendData strData
Example using HTTP POST Method
Code:
'Assumes Form fields named txtName and txtEmail
strData = "POST /Data.cgi HTTP/1.1" & vbCrlf
strData = strData & "ADDITIONAL HTTP HEADER INFO" & vbcrlf & vbcrlf
strData = stRData & "txtName=Digital+X%2DTreme&txtEmail=digital%5Fx%[email protected]"
'Connect to HTTP Server, then send
Winsock.SendData strData
Uploading a file i similar, but encoding it in the correct format is trickier. Below is an example of the data that is sent to an HTTP Server when a file is posted... The file is a small text file.
POST /upload.cgi HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------7d1226321c8
Content-Length: 315
-----------------------------7d1226321c8
Content-Disposition: form-data; name="fileFIELD"; filename="D:\Documents\Hello_World.txt"
Content-Type: text/plain
Hello World!
-----------------------------7d1226321c8--
Anyway, that is the format you would need to send the file upload in to an HTTP server. If you need more help, post back 
Laterz
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
-
Aug 7th, 2001, 12:23 PM
#7
Frenzied Member
Well......this code may work. I'm not sure, I managed to get it to submit for me, but I recieved an internal error. I'm guessing because of the Value "C:\whatever\whatever.jpg". Try changing this to a valid value and see if it works for you. I didn't want to upload a file.
You may want to go with Digital-X-Treme's code using a Winsock Control.
VB Code:
Option Explicit
Private Sub Command1_Click()
WebBrowser1.Navigate "http://www.vi2.com/maxForumFiles/"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WebBrowser1.Object) Then
If URL = "http://www.vi2.com/maxForumFiles/" Then
Debug.Print "yeah"
With WebBrowser1.Document
.Forms("FilePost").upfile.Value = "C:\whatever\whatever.jpg"
.Forms("FilePost").Description.Value = "250 character description"
.Forms("FilePost").submit
End With
End If
End If
End Sub
-
Aug 7th, 2001, 12:30 PM
#8
Thread Starter
Addicted Member
Well, my proggy already mis going to be required to use the webcontrol. So I figured I would use it for everything, instead of adding extra controls just to type out even more code..
So it still stands, will my code snippit work?
-
Aug 7th, 2001, 12:37 PM
#9
Fanatic Member
Why
Why do you need to use the WebBrowser control...? Surely you can choose to use the components that do the job, quickly and efficiently... Using the method i described wont be that much more code, and it will allow you direct access to the server, without having to mess about using the Web Browser control 
Laterz
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
-
Aug 7th, 2001, 12:41 PM
#10
Thread Starter
Addicted Member
Re: Why
Originally posted by [Digital-X-Treme]
Why do you need to use the WebBrowser control...? Surely you can choose to use the components that do the job, quickly and efficiently... Using the method i described wont be that much more code, and it will allow you direct access to the server, without having to mess about using the Web Browser control 
Laterz
Th webcontrol is being used for a different part of the proggy. To display a php generated page to display db query results.. inless you know of a way to get the result and parse the page without using the webcontrol then I will use it. I figure I don't want to add even more code and controsl inless I have to..
That, and I wouldn't even begain to know how to parse an html page to grab the info I need..
-
Aug 7th, 2001, 12:44 PM
#11
Frenzied Member
Your code won't work as it stands. If you use the code snippet I provided it should work.
Question: Has the "Upload" feature been implemented on the website already? The reason I ask is I just tryed to upload a valid file, and I recieved an internal error. Do I need to be logged in? I tried upping a 200kb zip file, and it appeared to be uploading, but then I recieved the internal error. Any idea why this occured?
-
Aug 7th, 2001, 12:47 PM
#12
Thread Starter
Addicted Member
The server got hammered by some serves in the same node that got the codred virus.. so he took the pic hosting part down for a little while to save his badwidth..
It does work though.. The whole backend is being written in php though.. with a mysql db to hold names, coments emails and the such..
do you know how I could get that code I posted to work?
-
Aug 7th, 2001, 01:06 PM
#13
Frenzied Member
Here ya go:
VB Code:
Private Sub cmdSubmit_Click()
WebBrowser1.Navigate "http://www.vi2.com/maxForumFiles/"
Do
DoEvents
Loop Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
If WebBrowser1.LocationURL = "http://www.vi2.com/maxForumFiles/" Then
With WebBrowser1.Document
.Forms("FilePost").upfile.Value = "C:\whatever\whatever.jpg"
.Forms("FilePost").Description.Value = "250 character description"
.Forms("FilePost").submit
End With
End If
End Sub
Another option, and maybe a better way would be to embed the html code that is used in the "File-Upload Process" right into your VB application. What that accomplished is 2 things. 1) The user wouldn't have to first navigate to the web-page in order to start the "File-Upload Process". 2) There may be a problem with trying to send input to the HTMLInputFileElement (This is the element that allows you to choose what file to upload). When your buddy allows posting of pictures again try the code above. It if doesn't work get ahold of me about embedding the html into your VB app. I'm positive it will work that way.
-
Aug 7th, 2001, 01:13 PM
#14
Thread Starter
Addicted Member
Originally posted by Bloodeye
Here ya go:
Another option, and maybe a better way would be to embed the html code that is used in the "File-Upload Process" right into your VB application. What that accomplished is 2 things. 1) The user wouldn't have to first navigate to the web-page in order to start the "File-Upload Process". 2) There may be a problem with trying to send input to the HTMLInputFileElement (This is the element that allows you to choose what file to upload). When your buddy allows posting of pictures again try the code above. It if doesn't work get ahold of me about embedding the html into your VB app. I'm positive it will work that way.
actually, i was going to have the webcontrol be hiddin, and whenver they click on the upload tab, the control goes to that page.. is there a better way?
Last edited by Dr.Sparkle; Aug 7th, 2001 at 01:16 PM.
-
Aug 7th, 2001, 01:26 PM
#15
Frenzied Member
One thing to think about, is if it's hidden how will they know that the file uploaded Ok?
Here's what I would do. I would have it visible, and in the WebBrower control would be just the html for uploading the file. You could have it look exactly like how it is at the web-page. All the elements within would be operational. So up-loading a file would look and function just as though you were actually at the web-site. Plus the side benefit is the user would know when or if the file uploaded Ok. 
If you want I can help you out with that.
-
Aug 7th, 2001, 01:27 PM
#16
Fanatic Member
Suggestions...
Originally posted by Dr. Sparkle
...inless you know of a way to get the result and parse the page without using the webcontrol then I will use it.
Here is what i suggest.
You could retrieve the PHP page using HTTP Protocol and a Winsock control.
If you know the format of the PHP generated pages, then it will be easy to parse the information from them...
Post back if help is needed.
Laterz
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
-
Aug 7th, 2001, 01:36 PM
#17
Thread Starter
Addicted Member
Re: Suggestions...
Originally posted by [Digital-X-Treme]
Here is what i suggest.
You could retrieve the PHP page using HTTP Protocol and a Winsock control.
If you know the format of the PHP generated pages, then it will be easy to parse the information from them...
Post back if help is needed.
Laterz
Well, I will know what teh generated structure will be once it's done. It will be whatever I want it to be. The problem is, I'm not writing the backend of it. Just the frontend for the proggy and the web. And the backend has not been writtin yet.. there has been a cople set-backs..
I was thinking of having to php scripts.. one that outputs to hml for the web, and another for my programe.. the one for my programe would kinda be like XML in structure..
kinda like
Code:
<pic>pic</pic>
<name>blah</name>
<email>email</email>
<coment>Coment</coment>
<pic>pic</pic>
<name>blah</name>
<email>email</email>
<coment>Coment</coment>
<pic>pic</pic>
<name>blah</name>
<email>email</email>
<coment>Coment</coment>
<pic>pic</pic>
<name>blah</name>
<email>email</email>
<coment>Coment</coment>
I was thinking of it out put like that, and some how parse that to add each item to a datagrid.. then letting them just doubleclick on the pic they want to preview and have it come up..
anyway, bloodeye, when he puts it back up, i'll try that. Thanks..
Is there no way to get into back on what the webbrowser control kinda like http of ftp has?
(edit) I really need to spell check and ****..
Last edited by Dr.Sparkle; Aug 7th, 2001 at 01:43 PM.
-
Aug 7th, 2001, 02:51 PM
#18
Thread Starter
Addicted Member
Ok, I figured out the parsing now(well, someone else did for me).. So I will do it that way.. But I still can't figure out how to upload a file and send parms without the webcontrol.. argh..
here is my parsing code..
VB Code:
Private Sub DoTagSearch(sText As String)
Dim nPos As Integer 'Holds where the "<" starts
Dim nClose As Integer 'Holds where the close tag "</" is found
Dim nTagEnd As Integer 'Holds where the ">" is found after npos
Dim bDone As Boolean 'Should this sub still search?
Dim sType As String 'Temporary place to hold the value
Dim sData As String 'Holds the data in the tag
bDone = True 'Yes, we should search
While bDone = True
nPos = InStr(nPos + 1, sText, "<", vbTextCompare) 'Find the next "<"
If nPos = 0 Then bDone = False ' If it didn't find anything, stop searching
If bDone = True Then 'make sure we are still searching
nTagEnd = InStr(nPos, sText, ">", vbTextCompare) 'find the ">" after the "<"
nClose = InStr(nTagEnd, sText, "</", vbTextCompare) ' look for the "</" after the last tag end
sType = Mid(sText, nPos + 1, nTagEnd - nPos - 1) 'Get the data between the "<" and the ">"
sData = Mid(sText, nTagEnd + 1, nClose - nTagEnd - 1) ' get the data between ">" and "</"
nPos = nClose + 1 'tell program to look from past the last "</"
AddResult sType, sData 'Add the result
End If
Wend
End Sub
------------------------------------------------------------------------------------------
Private Sub AddResult(sType As String, sData As String)
If Trim(sData) = "" Then Exit Sub
Select Case UCase(sType)
Case "PIC": MsgBox "Found Picture: " & sData
Case "EMAIL": MsgBox "Found Email: " & sData
Case Else: MsgBox "Found " & sType & ": " & sData
End Select
End Sub
Later on I will add the true actions it takes when it gets the data, like add it to the grid..
-
Aug 9th, 2001, 11:37 AM
#19
PowerPoster
hello I am trying to this code I got from Bloodeye a while ago. It used to work but I am trying to submit through a post method ona PHP page.
I keep getting the error:
"Object variable or with block variable not set"
Any ideas what's up?
Code:
Private Sub Command1_Click()
WebBrowser1.Navigate "http://www.alltheweb.com/add_url.php"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim submitalltheweb As String, submittedalltheweb As String
Static x As Integer
submitalltheweb = "http://www.alltheweb.com/add_url.php"
submittedalltheweb = Mid(WebBrowser1.LocationURL, 1, 29)
If (pDisp = WebBrowser1.Object) Then
If submittedalltheweb = "http://www.alltheweb.com/add_url.php" Then
WebBrowser1.Navigate submitalltheweb
ElseIf WebBrowser1.LocationURL = submitalltheweb Then
With WebBrowser1.Document.Forms(1)
'If x > 9 Then Exit Sub
.All("url").Value = "www.test.com"
.All("submit").Click
'x = x + 1
End With
End If
End If
End Sub
-
Aug 9th, 2001, 11:45 AM
#20
Frenzied Member
Hey Bud -
What line is it highlighting when you get the error?
-
Aug 9th, 2001, 11:46 AM
#21
PowerPoster
.All("url").Value = "www.test.com"
-
Aug 9th, 2001, 11:51 AM
#22
Frenzied Member
This is just a guess:
Check the name of the input text-box that you are trying to fill-in at http://www.alltheweb.com/add_url.php
Look in the html code. The name maynot be "url"
as it is in this line: .All("url").Value = "www.test.com"
-
Aug 9th, 2001, 11:52 AM
#23
PowerPoster
it is I checked
Code:
<td align=left><input type=text value="http://" size=40 name=url></td>
-
Aug 9th, 2001, 12:09 PM
#24
Frenzied Member
Ok....I see now. This page only has 1 form to fill-in.
So try this:
Code:
With WebBrowser1.Document.Forms(0)
'If x > 9 Then Exit Sub
.All("url").Value = "www.test.com"
.All("submit").Click
'x = x + 1
End With
'//OR This:
With WebBrowser1.Document
'If x > 9 Then Exit Sub
.All("url").Value = "www.test.com"
.All("submit").Click
'x = x + 1
End With
'//OR This
With WebBrowser1.Document
'If x > 9 Then Exit Sub
.Forms(0).url.Value = "www.test.com"
.Forms(0).submit.Click
'x = x + 1
End With
One of those should work......if not I have a few more.
-
Aug 9th, 2001, 12:13 PM
#25
PowerPoster
this is VERY interesting!!!!! All 3 of your examples actually submit the url BUT I still get the same error message as before but after the page has been submitted!
-
Aug 9th, 2001, 12:25 PM
#26
Frenzied Member
The problem is the URL that you submit to: http://www.alltheweb.com/add_url.php
Is the same URL as the page that is loaded after it's been submitted:
http://www.alltheweb.com/add_url.php
The easiest thing to do would be to add:
On Error Resume Next to the WebBrowser1_DocumentComplete Event.
If you wanted to do it by the book, then you would have to code a condition haveing it search the web-page "first" to see if there is an input text-box to add a value to.
-
Aug 9th, 2001, 12:37 PM
#27
PowerPoster
-
Aug 12th, 2001, 07:06 PM
#28
Frenzied Member
Dr.Sparkle -
Here's the zip file....
-
Dec 18th, 2001, 08:36 PM
#29
a little more info on code operation
I'm also trying to upload a file via http using VB, and the code has been helpful (downloaded from Bloodeye, I think).
I'm trying to send several files to an apache server running Perl, but I appear to be having some problems where the debugger stops at:
Set docinputFile1 = doc.Forms(0).elements(0)
I wasn't sure what references need to be set or other pointers may be necessary. Pls help.
Thanks!
-
Dec 19th, 2001, 01:02 AM
#30
Frenzied Member
All the references are already set within the project. It may be that you are using an old version of Internet Explorer? If that's the case try changing this in the Declarations.
BTW: Are you having trouble running the project that you downloaded, or are you having problems adapting it to your html code?
Code:
Dim docinputText1 As HTMLInputTextElement
to
Dim docinputText1 As Object
-
Dec 19th, 2001, 05:26 PM
#31
I'm using W2K, IE 5.0.x is that too old?
The downloaded code appears to work, so my problem appears to be adapting it to my html code. I actually don't need to do this in HTML, but I thought it would be the easiest way. Would it be easier if I tried using a stright VB app?
The exact error code is:
Run-time error '91':
Object variable or With block variable not set
The debugger is pointing at the line:
Set docinputFile1 = doc.Forms(0).elements(0)
I tried the changes to 'object' which gives the same run-time error in the same place. I don't know the Perl back-end and my VB for html isn't too deep, so I was wondering if it's easier or safer to do VB only without the HTML? Any direction is appreciated.
Thanks for your help!
-
Dec 19th, 2001, 10:37 PM
#32
Frenzied Member
Without seeing your html code, I wouldn't be able to tell you what the problem is.
It could be that Forms(0) is supposed to be Forms(1), or maybe there is a similar problem with the elements(0)...
If you want, you can post your project and I'll take a look at it.
-
Dec 20th, 2001, 01:47 AM
#33
Thanks!
Okay, I found a typo and the Run-time 91 does not happen when experimenting with Bloodeye's modified script below (not actual URL). I guess the htmldoc was not created due to the typo, but I'm still not there yet...
Private Sub htmlUpload()
'This is all the html code for your Upload Page
'I've reduced it to just the Upload html and modified it a little.
uploadPage = "about:<html><head><style media=""screen"" type=""text/css"">"
uploadPage = uploadPage & "body { font-size: 11px; font-family: Verdana, Arial }"
uploadPage = uploadPage & "</style></head><body bgcolor=""#3f3f3f"" scroll=""no"" text=""gray""><center>"
uploadPage = uploadPage & "<form name=""FilePost"" action=""http://myweburl.com/handler.cgi?username_entry=username&password_entry=pass&filesys=filesys"" method=""post"" enctype=""multipart/form-data"">"
uploadPage = uploadPage & "<table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""300""><tr><td width=""5"" bgcolor=""#434343""></td>"
uploadPage = uploadPage & "<td bgcolor=""#868686"" class=""newstitile""><font size=""1"" color=""#e4e4e4""> </font></td>"
uploadPage = uploadPage & "<td bgcolor=""#434343"" width=""5""></td></tr></table><table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""300"" bgcolor=""#434343"">"
uploadPage = uploadPage & "<tr><td width=""5""></td><td width=""300"" valign=""top""><font size=""1"">Select the file which you wish to upload: <br></font>"
uploadPage = uploadPage & "<input type=""file"" name=""upfile"" size=""22""><font size=""1""><br>Name, email and a brief description of the file: </font>"
uploadPage = uploadPage & "<input type=""text"" name=""description"" maxlength=""250"" size=""41""><br><font size=""1""><br></font>"
uploadPage = uploadPage & "<table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%""><tr><td><input type=""submit"" value=""Upload File""></td>"
uploadPage = uploadPage & "<td></td><td><input type=""reset"" value=""Reset""></td></tr></table><br></form><center><font size=""1""> Temp Filler text.</font></center>"
uploadPage = uploadPage & "<center><font size=""1"" color=""#afafaf""> Filler text for now</font></center></body></html>"
WebBrowser1.Navigate uploadPage
End Sub
When I run the prog from inside VB6, the target webpage comes up, I can choose a file, and try to submit, but the file never gets through. My problem may be the authentication structure of the target page, but I'm not sure. The upload never happens, and I end up with my login page in the browser area of the VB program.
I may need to attempt the upload in a non-password protected area to verify the general VB works as it originally did. My end goal is to have the VB prog use standard FSO to choose the file, then use HTTP post to upload it to a secure location. So, I guess I need help on:
1. passing the file name(s) to the html document
2. constructing the post to send the html document to the server
3. making sure the client can send enough info to pass through authentication AND upload the file.
The handler page (handler.cgi) if accessed directly simply has a form input, browse, and submit button. This web page works, and allows a web based upload of a file.
-
Dec 20th, 2001, 02:22 AM
#34
Frenzied Member
I'll have to check it out later...Time to Sleep.
Do you need to be logged in to upload?
Do you have an upload page on the server?
You know you could always just navigate to this page, and upload your files.
-
Dec 20th, 2001, 02:48 PM
#35
Frenzied Member
Ok...Well, I'm not sure where your at right now.
Sounds to me like you have the username/password (login) situation somewhat under control.
As far as using FSO, I don't see the need. The user will be able to browser for the file to upload using the "<input=file>" element within the html.
Maybe you have something else in mind?
It's a little difficult for me to help without having an actual URL to work with.
I understand your security concerns....Is there any way you can issue me a Username/Password combo so that we can get this working?
Once it's working,then you can delete the Username/Password combo.
The more I think about it, you might be better off using the Winsock Control.
I say that for 2 reasons:
1) The only way we would be able to pass the FSO File&Location to the "<input=file>" element in the html is by using copy& paste.
That's because this element is deemed to be a security risk by MS.
So there is no direct method of inputing a File&Location to this element without pasting it in.
2) The username/password authentication issue.
I'm not sure, we may be able to add a "username assword@" in the BeforeNavigate2 Event.
The thing is Winsock would be better equipped to handle this.
-
Dec 20th, 2001, 09:37 PM
#36
should I move this post?
Bloodeye, I can't get the account changes yet, but I did find and modify some code below. The only problem is that the logon info doesn't take me to the correct page for the upload, so the upoad doesn't occur. When I use the correct URL, it takes me to the correct page.
I'll see if I cant get you an account, but in the mean time, this example almost gets me there... and can benefit others.
'******************* upload - begin
'Upload file using input type=file
Sub UploadFile(DestURL As String, FileName As String, _
Optional ByVal FieldName As String = "File")
Dim sFormData As String, d As String
'Boundary of fields.
'Be sure this string is Not In the source file
Const Boundary As String = "---------------------------0123456789012"
'Get source file As a string.
sFormData = GetFile(FileName)
'Build source form with file contents
d = "--" + Boundary + vbCrLf
d = d + "Content-Disposition: form-data; name=""" + FieldName + """;"
d = d + " filename=""" + FileName + """" + vbCrLf
d = d + "Content-Type: application/upload" + vbCrLf + vbCrLf
d = d + sFormData
d = d + vbCrLf + "--" + Boundary + "--" + vbCrLf
'Post the data To the destination URL
IEPostStringRequest DestURL, d, Boundary
End Sub
'sends URL encoded form data To the URL using IE
Sub IEPostStringRequest(URL As String, FormData As String, Boundary As String)
'Create InternetExplorer
Dim WebBrowser: Set WebBrowser = CreateObject("InternetExplorer.Application")
'You can uncoment Next line To see form results
WebBrowser.Visible = True
'Send the form data To URL As POST request
Dim bFormData() As Byte
ReDim bFormData(Len(FormData) - 1)
bFormData = StrConv(FormData, vbFromUnicode)
WebBrowser.Navigate URL, , , bFormData, _
"Content-Type: multipart/form-data; boundary=" + Boundary + vbCrLf
Do While WebBrowser.busy
' Sleep 100
DoEvents
Loop
WebBrowser.Quit
End Sub
'read binary file As a string value
Function GetFile(FileName As String) As String
Dim FileContents() As Byte, FileNumber As Integer
ReDim FileContents(FileLen(FileName) - 1)
FileNumber = FreeFile
Open FileName For Binary As FileNumber
Get FileNumber, , FileContents
Close FileNumber
GetFile = StrConv(FileContents, vbUnicode)
End Function
'******************* upload - end
Private Sub Form_Load()
UploadFile "http://urlhandler.cgi?usr=name&pass=pass&info=filesave", "D:\Documents and Settings\qa1\Desktop\smplUploadFile.gif"
End Sub
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
|