Community

How to post file with nodejs?

I use request module to make post request (Coffeescript):

request
    method: 'POST'
    uri: "http://cloud.ocrsdk.com/processImage"
    headers:
        Authorization: 'Basic: ' + new Buffer("#{id}:#{password}").toString 'base64'
    qs:
        language: 'russian'
        imageSource: 'scanner'
        exportFormat: 'xml'
    body: file_content
But I get response 551 "Unsupported image file format". How I must send file? How your server know, which format file have? Must I specify file format anywhere? How must http package look like?

I learn samples (.net and python), watch traffic with WireShark, and try to do the same on nodejs, but it does not work.

0

Comments

2 comments

Please sign in to leave a comment.