Hi People,
I need help to upload a file from our PB system to a server using a HTTP form. I am trying to use the MSXML object but am getting an error saying "Invalid or missing payload file".The address,tokens, files etc work using the postman app so must be something in my code. See code below.
ls_Method = "POST"
ls_Url = "https://site.com.au/api/message"
loo_xmlhttp = CREATE oleobject
loo_xmlhttp.ConnectToNewObject("Msxml2.XMLHTTP.6.0")
loo_xmlhttp.open (ls_Method, ls_Url, false)
loo_xmlhttp.setRequestHeader("Content-Type", "multipart/form-data; boundary=----WebKitshort")
loo_xmlhttp.setRequestHeader("Authorization", "Bearer " + ls_token)
ls_data = '------WebKitshort~r~nContent-Disposition: form-data; name="payloadFile"; filename="C:\\temp\\notmuchhere.txt"~r~nContent-Type: text/plain~r~n~r~n~r~n------WebKitshort~r~nContent-Disposition: form-data; name="clientUUID"~r~n~r~nTEST-0001~r~n------WebKitshort~r~nContent-Disposition: form-data; name="messageType"~r~n~r~nSubmit.002.00~r~n------WebKitshort--'
loo_xmlhttp.send(ls_data)
Do I need to include the file as a blob in the data. If so, any ideas how. Thanks Michael