I am recieving this base64 encoded string from a request paramter on my express server, I even did
var fixed = req.body.media.toString().replace(/\r?\n|\r/g, '')
To remove any line breaks and twitter still gives me an error. "media type unrecognized"
The base64 encoded image needs to have data:image/jpeg;base64 removed in order for twitter to accept it, so I did:
var base64Data = encodedImage.replace(/^data:image\/png;base64,/, ""); and it worked!
I am trying to upload an image using a base64 encoded string. I do:
I am recieving this base64 encoded string from a request paramter on my express server, I even did
var fixed = req.body.media.toString().replace(/\r?\n|\r/g, '')
To remove any line breaks and twitter still gives me an error. "media type unrecognized"
What am I doing wrong here?