Thuzi / facebook-node-sdk

Modeled from the (Facebook Javascript SDK), now with the facebook-node-sdk you can now easily write the same code and share between your server (nodejs) and the client (Facebook Javascript SDK).
Other
737 stars 250 forks source link

How to attach a file to Fb.api? #102

Open dfb243fda opened 9 years ago

dfb243fda commented 9 years ago

Hello, I want to upload a picture to an album. Here is my code: FB.api(folderId + '/photos', 'post', {"source": fs.createReadStream(filePath)}, function (res) { if(!res || res.error) { console.log(!res ? 'error occurred' : res.error); return; } console.log('Post Id: ' + res.id); }); In this case I get the error from facebook: (#324) Requires upload file.

dantman commented 8 years ago

This should work now in 1.1.0-alpha1.