Skip to content

Instantly share code, notes, and snippets.

@jejacks0n
Created April 30, 2011 19:55
Show Gist options
  • Save jejacks0n/949942 to your computer and use it in GitHub Desktop.
Save jejacks0n/949942 to your computer and use it in GitHub Desktop.
// version 1: working, but not providing what's being sent
// we need to have full posts come through so rails can get the info
xhr.open(this.method, this.action, true);
xhr.setRequestHeader('Accept', 'text/javascript, text/html, application/xml, text/xml, */*');
xhr.setRequestHeader('Content-Type', 'multipart/form-data');
xhr.setRequestHeader('X-Version', '1');
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('X-CSRF-Token', this.token);
xhr.setRequestHeader("X-File-Name", this.file.name);
xhr.setRequestHeader("X-File-Size", this.file.size);
xhr.send(this.file.file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment