Skip to content

Instantly share code, notes, and snippets.

@amici-fos
Created September 24, 2016 19:21
Show Gist options
  • Save amici-fos/2778e4a1e3f75cf7d5e105345e568aef to your computer and use it in GitHub Desktop.
Save amici-fos/2778e4a1e3f75cf7d5e105345e568aef to your computer and use it in GitHub Desktop.
function ajaxUpload(a){
files=a.files[0];//get file
formdata=new FormData(); // created http transport object
formdata.append("files",files) ;// append a new value and this is going to send as post
ajax=new XMLHttpRequest();
ajax.upload.addEventListener("progress",console.log(1),false)
ajax.open("POST","manage.php/upload");
ajax.send(formdata);
function progressHandler(e){
console.log(e.loaded/e.total);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment