Created
November 21, 2011 16:55
-
-
Save adis-io/1383211 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', 'http://image.torrent.kg/images/U8x5261.png', false); | |
xhr.responseType = 'arraybuffer'; | |
xhr.send(); | |
var blob = new WebKitBlobBuilder(); | |
blob.append(xhr.response); | |
var file = blob.getBlob('image/png'); | |
console.log(file) | |
var fd = new FormData(); | |
fd.append("image[0]", file); | |
var xhr2 = new XMLHttpRequest(); | |
xhr2.open('POST', 'http://image.torrent.kg/api/upload', false); | |
xhr2.send(fd); | |
console.log(xhr2.responseText); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment