if you are asking about client side (js), then this would work fine, assuming you have an Upload controller that accepts post request on “/upload”
...
function sendFIle(file) {
var uri = "/upload";
var xhr = new XMLHttpRequest();
var fd = new FormData();
xhr.open("POST", uri, true);
xhr.upload.addEventListener("progress", function(e) {
if (e.lengthComputable) {
var percentage = Math.round((e.loaded * 100) / e.total);
}
}, false);
fd.append('myFile', file);
xhr.send(fd);
}
...
copied from MDN ![]()






















