Upload a file with POST (multipart/form-data) using VBA

Posted by Moses Ting on Stack Overflow See other posts from Stack Overflow or by Moses Ting
Published on 2010-05-05T20:33:54Z Indexed on 2010/05/05 20:38 UTC
Read the original article Hit count: 422

Filed under:

Does anyone know if it's possible to upload a file via POST body (multipart/form-data) using VBA? I'm currently using the Microsoft.XMLHTTP object, but I'm not tied to it if that doesn't support multipart POST.

Here's what I'm doing so far:

Set oHttp = CreateObject("Microsoft.XMLHTTP")
oHttp.Open "POST", theUrl, False
oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oHttp.Send "body=thebody"

© Stack Overflow or respective owner

Related posts about vba