How to post file with nodejs?

  • Last Post 20 August 2012
log0div0 posted this 18 August 2012

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

    method: 'POST'
    uri: ""
        Authorization: 'Basic: ' + new Buffer("#{id}:#{password}").toString 'base64'
        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.

Order By: Standard | Newest | Votes
log0div0 posted this 19 August 2012

Problem solved. file_content must be a Buffer object, not String.

  • Liked by
  • Dmitry Me
SDK Support Team posted this 20 August 2012

You can also take a look at a third-party library in coffeescript to access cloud ocr sdk:

  • Liked by
  • Dmitry Me
  • log0div0