    body.append(&quot;myfile&quot;, file)
}</code></pre>
<p>Next, you need to call <code>m.request</code> and set <code>options.method</code> to an HTTP method that uses body (e.g. <code>POST</code>, <code>PUT</code>, <code>PATCH</code>) and use the <code>FormData</code> object as <code>options.body</code>.</p>
<pre><code class=language-javascript>function upload(e) {
    var file = e.target.files[0]

    var body = new FormData()
    body.append(&quot;myfile&quot;, file)

    m.request({
        method: &q