ttezel / twit

Twitter API Client for node (REST & Streaming API)
4.31k stars 570 forks source link

'media/upload' : 'media type unrecognized.' with base64 encoding. #261

Open hemanth opened 8 years ago

hemanth commented 8 years ago

On media/upload with fs.readFileSync('./image', { encoding: 'base64' })

I am getting:

{ request: '/1.1/media/upload.json',
  error: 'media type unrecognized.' }

Due to which I get the below error on media/metadata/create:

{ [Error: Missing json payload.]
  message: 'Missing json payload.',
  code: null,
  allErrors: 
   [ { request: '/1.1/media/metadata/create.json',
       error: 'Missing json payload.' } ],
  twitterReply: 
   { request: '/1.1/media/metadata/create.json',
     error: 'Missing json payload.' },
  statusCode: 400 }

P.S: The image is fine, it does render properly in the browser.

ericlw commented 8 years ago

I encounter the same problem

JonnyBurger commented 8 years ago

Make sure to remove the prefix, e.g. data:image/jpeg;base64, first!