CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2001
    Posts
    3

    HTTP Upload - An Answer

    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.


  2. #2
    Join Date
    Oct 2001
    Posts
    24

    Re: HTTP Upload - An Answer

    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?



  3. #3
    Join Date
    Jan 2002
    Posts
    1

    Re: HTTP Upload - An Answer

    I tried to use the code sample but, I got following Error: Cannot coerce type (Err.Nr: 35760) Can you help me??



  4. #4
    Join Date
    Mar 2001
    Location
    India
    Posts
    13

    Re: HTTP Upload - An Answer

    I have a similar requirement. Pl give me more info at the earliest.

    Archana

  5. #5
    Join Date
    Jul 2001
    Posts
    3

    Re: HTTP Upload - An Answer

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured