Im uploading an image that's taken from a flash movie (the camera
control) like this:
$.ajax({
url: '/smilexhr',
data: 'img='+base64encoded,
type: 'POST',
});
and then trying to decode and save:
app.post('/upload', function(req, res) {
var file = new Buffer(req.body.img, 'base64')
ws = fs.writeFile('./testuploaded.jpg', file, function(err) {
if(err) {
console.log(err);
} else {
console.log("The file was saved!");
}
});
});
It saves something but its not a jpg - am I missing something
obvious? Any suggestions would be great..
Thanks