How can I upload a string as a file, with an http post request using node.js
?
Here is what I tried:
var unirest = require('unirest');
unirest.post('127.0.0.1/upload')
.headers({'Content-Type': 'multipart/form-data'})
.attach('file', 'test.txt', 'some text in file') // Attachment
.end(function (response) {
console.log(response.body);
});
but nothing happens