fbpx

Uploading Files (Multipart MIME)

You are here:
< Back

Multipart MIME is a standard used for uploading files to webservers. All the API resources which support file uploads in ET use this standard.

Uploads look like this:

POST /EnterpriseTester/api/stepresult/25eb6aa0-3514-48bf-8c59-a21200d7a6fc/attachments HTTP/1.1Host: 127.0.0.1Content-Type: multipart/mixed; boundary=65bf6b94-c91c-442c-abe7-f41444d7c71fContent-Length: 3Authorization: Basic bGFidmlldzpvbnNhbGE= --65bf6b94-c91c-442c-abe7-f41444d7c71fContent-Disposition: attachment; filename="notes.txt"; name=notes; size=3Content-Type: text/plainContent-Length: 3 ABC--65bf6b94-c91c-442c-abe7-f41444d7c71f--

Typically – a library will generate this for you – but if you are generating it yourself then the key points are as follows:

  1. Content type set to “multipart/mixed”.
  2. A “boundary=[something unique]”
  3. The boundary starts and ends the body of the POST. (with — at the start and –[boundary]– at the end)
  4. There must be a blank line between the headers for the part and the part content. (in the example – between Content-Length: 3 and ABC)