Created
July 25, 2014 23:09
-
-
Save hayes/73149125049b18a44b09 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function upload_file(file) { | |
var fd = new FormData | |
, self = this | |
fd.append('file', file) | |
var xhr = request.post(url, {}, fd, function(err, response, headers) { | |
if(err) { | |
// non 200 resonse will be an error | |
// handle error | |
} | |
//response should be an object constructed from a json response | |
//headers will be response headers | |
}) | |
//remove timeout | |
xhr.timeout = 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment