On Thu, Apr 05, 2012 at 04:57:30PM -0700, Mehdi Avdi wrote:
> I'm sending the contents of this Flex form (Don't ask why) over to node.
> There is a post paramteter called "photo" which is a base64 encoded image.
>
> Contents of photo get sent over ok. Problem is when I am trying to decode
> the content and write them to a file.
>
> var fs = require("fs");
>
> fs.writeFile("arghhhh.jpg", new Buffer(request.body.photo,
> "base64").toString(), function(err) {});
That's totally wrong. Leave out the .toString():
fs.writeFile("arghhhh.jpg", new Buffer(request.body.photo, "base64"),
function(err) {});
pgpCIEnnWjk0h.pgp
Description: PGP signature
