Skip to content

Instantly share code, notes, and snippets.

@beatgammit
Created June 7, 2011 19:58
Show Gist options
  • Save beatgammit/1013020 to your computer and use it in GitHub Desktop.
Save beatgammit/1013020 to your computer and use it in GitHub Desktop.
Webkit: XHR push files
function upload(url, uint8Data) {
var xhr,
formData = new FormData(),
blobBuilder = new WebKitBlobBuilder(),
blob;
blobBuilder.append(uint8Data);
blob = blobBuilder.getBlob();
formData.append('aFile', blob);
xhr = new XMLHttpRequest();
xhr.open('POST', url, true);
xhr.send(formData);
// xhr.send(blob);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment