Created
May 17, 2015 09:24
-
-
Save noppolp/00f87743ffbb0dfd532b to your computer and use it in GitHub Desktop.
Upload file using restler
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
| var rest = require('restler'); | |
| var FileInfo = require('./FileInfo.js'); | |
| var file = new FileInfo([FULL PATH OF YOUR FILE]); | |
| rest.post([API_ULR], { | |
| multipart: true, | |
| data: { | |
| file: rest.file(file.fullPath, file.name, file.size, null, file.contentType) | |
| }, | |
| }).on('complete', function(data, response) { | |
| if (response.statusCode == 201) { | |
| console.log('upload success'); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment