;, {onchange: upload}),
            progress + &quot;% completed&quot;
        ]
    }
})

function upload(e) {
    var file = e.target.files[0]

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

    m.request({
        method: &quot;POST&quot;,
        url: &quot;/api/v1/upload&quot;,
        body: body,
        config: function(xhr) {
            xhr.upload.addEventListener(&quot;progress&quot;, function(e) {
                progress = e.loaded / e.total

                m.redraw() 