Javascript: Upload image from Canvas to FB via Graph API
问题 I am composing an image in a canvas, I get the base64 image data by using canvas.toDataURL('png') and trimming the additional information. var dataUrl = canvas.toDataURL('png'); var escapedBase64Data = dataUrl.replace("data:image/png;base64,",""); After that I try to post to facebook using: FB.api('/me/photos', 'post', { source:data}); Photos (https://developers.facebook.com/docs/reference/api/user/) has a source property. This is where you will place the data content ( multipart/form-data )