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.