I am new to Web Dev and Meteor, and all things are REST, but I'm trying to write a server-side method to send a request to publish Meteor HTTP to a third-party server and upload the image to it. I have setup issues. I want to upload a file to the body of the multipart / form-data section, but I'm having problems creating the correct request ...
This is what I have:
Meteor.methods({ postOCR:function(newFile){ var options = { headers: {'secret': mySecret, 'Content-Type': 'multipart/form-data'}, data: {'Content-Disposition': 'form-data', 'name':'image', 'filename':newFile } } HTTP.call('POST', url, options, function(error, result) { if (error) { console.log('ERRR'); console.log(error); } else console.log('RESULT'); console.log(result); }); } });
And this is the query I'm trying to build:
POST /some/res HTTP/1.1 Host: myUrl secret: mySecret Cache-Control: no-cache
The original request goes fine, but I don't seem to upload the file correctly ... Can someone tell me what I'm doing wrong?
Thanks!
source share