# Uploading Files (multipart/form-data)

Some APIs require you to upload files, which is usually done using the multipart/form-data content type.

This can be achieved in Midio using `Http.Body.Create Form Field File` `Http.Body.Create Form Field Value`  and `Http.Body.Encode Multipart FormData` .

<figure><img src="/files/b8qliGpouILNINqblqN9" alt=""><figcaption></figcaption></figure>

In the example above, we fetch an image as a buffer, which we then convert to a form field file using `Create Form Field File`. All form fields are sent as inputs to `Encode Multipart FormData`, which returns two values: a `Content-Type` header value and the encoded body. We place the header value in an object with the field value `Content-Type` and use it in the headers input when calling the API that requires a file upload. We use the `multipart/form-data` output as the body.

{% hint style="warning" %}
It is important to include the header, as it contains information about how the form data is encoded in the body.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.midio.com/midio-docs/guides/http/uploading-files-multipart-form-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
