Back to product page

HttpRequestFormUpload object


HttpRequestFormUpload Class.


Methods
AddAdds new variable item to the collection.
AddFileAdds new file item to the collection.

Remarks

This object is used to change Body contents of current request, so that it adds your variables and files which should be uploaded to the server. For example, you can upload file and set uploader name using VB code like this:

(feel free to go to /HttpDLX/Demo/TestFormUpload.htm to see what kind of behavior we are trying to duplicate with below code)

     
    wodHttp1.Request.FormUpload.AddFile "TheFile", "c:\log.txt" 'put real file instead of this one
    wodHttp1.Request.FormUpload.Add "Name", "WeOnlyDo! test application"
    wodHttp1.Blocking = True
    wodHttp1.Post "/HttpDLX/Demo/TestFormUpload.asp"
     

which will produce request body like this to be sent:
    POST /HttpDLX/Demo/TestFormUpload.asp HTTP/1.0
    Host: www.weonlydo.com
    Content-Type: multipart/form-data; boundary=---------------------------6e372e8e22c8
    Content-Length: 339

    -----------------------------6e372e8e22c8
    Content-Disposition: form-data; name="TheFile"; filename="log.txt"
    Content-Type: application/octet-stream

    DHCP Server Started

    -----------------------------6e372e8e22c8
    Content-Disposition: form-data; name="Name"

    WeOnlyDo! test application
    -----------------------------6e372e8e22c8--

Platforms

Windows