HTTPPOST to upload an XML file to a web form

I am trying to use HTTPPOST to upload an XML file via a web page. Content type needs to be multipart/form-data and it is posting to a form.

 

This works using Curl but I would like to do this in my program using HTTPPOST. Here is an example of the curl command that works:

curl --form user=USERNAME --form pass=PASSWORD --form uploadfile=@XMLFILE.xml URL

 

I'm not sure how to do this using HTTPPOST. Do I need to set the payload to match the body of the post or is there a better way?

I set a trace on curl and I can see the body of the post but it's a lot of information to hard code in a program.

 

Any help and advice would be great.

Thank you

Tags: