Skip to content

Instantly share code, notes, and snippets.

@gabrielfalcao
Created April 24, 2012 06:07
Show Gist options
  • Save gabrielfalcao/2476990 to your computer and use it in GitHub Desktop.
Save gabrielfalcao/2476990 to your computer and use it in GitHub Desktop.
xhr.upload
[4/24/12 1:31:47 AM] Maxwell Dayvson: var fd = new FormData();
var file = this.input.files[0];
fd.append(this.input.name, file);
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener("progress", function(evt){});
xhr.upload.addEventListener("load", function(evt){});
xhr.upload.addEventListener("error", function(evt){});
xhr.upload.addEventListener("abort", function(evt){});
xhr.open("POST", "/url");
xhr.send(fd);
[4/24/12 1:32:01 AM] Maxwell Dayvson: var fd = new FormData();
var file = this.input.files[0];
fd.append(this.input.name, file);
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener("progress", function(evt){});
xhr.addEventListener("load", function(evt){});
xhr.addEventListener("error", function(evt){});
xhr.addEventListener("abort", function(evt){});
xhr.open("POST", "/url");
xhr.send(fd);
[4/24/12 1:33:34 AM] Maxwell Dayvson: file.value ="file:///sadad/asda/dasda.jpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment