Click to See Complete Forum and Search --> : HTTP Upload - An Answer


Giant_Heart
July 17th, 2001, 05:02 AM
I have seen a number of posts requesting how to upload a file programmatically via HTTP. Here is a solution in VB using the INet control.


Dim oFileSystem as new Scripting.FileSystemObject

s = "-----------------------------AaB03x" & vbCrLf & _
"content-disposition: form-data; name=""field1""; filename=""autoexec.bat""" & vbCrLf & _
"Content-Type: text/plain" & vbCrLf & vbCrLf & _
oFileSystem.GetFile("c:\autoexec.bat").OpenAsTextStream.ReadAll & _
"-----------------------------AaB03x--"
Inet1.Execute "http://localhost/sample1.asp", _
"POST", s, "Content-type: multipart/form-data, boundary=AaB03x"




Synopsis... A Request is formatted according to RFC1867 using the FileSystem object to insert the file content. It then posts it to the URL using the INet routines.

I can send more information upon request and please send me any feedback on this.

samagna
December 28th, 2001, 08:22 AM
My requirement is to upload files from a vb application via HTTP.
Using INet Control seems to be useful.
Can I get more information regarding this?

Ztefan
January 15th, 2002, 07:01 AM
I tried to use the code sample but, I got following Error: Cannot coerce type (Err.Nr: 35760) Can you help me??

Archana999
February 13th, 2002, 02:33 AM
I have a similar requirement. Pl give me more info at the earliest.

Archana

Giant_Heart
February 13th, 2002, 05:13 PM
After some more work in this area I don't recommend this approach at all for a production environment. You would be better off using cURL or the libcURL libraries available at http://curl.haxx.se