Skip to content

Instantly share code, notes, and snippets.

@meritt
Created December 22, 2009 13:43
Show Gist options
  • Save meritt/261750 to your computer and use it in GitHub Desktop.
Save meritt/261750 to your computer and use it in GitHub Desktop.
var reader = new FileReader();
reader.onload = function(e) {
var bin = e.target.result;
// bin is the binaryString
};
reader.readAsBinaryString(file);
var xhr = new XMLHttpRequest();
xhr.open("POST", "upload.php");
xhr.overrideMimeType('text/plain; charset=x-user-defined-binary');
xhr.sendAsBinary(bin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment