Skip to main contentdfsdf

Home/ schemunilte's Library/ Notes/ Post Image To Facebook Button

Post Image To Facebook Button

from web site

=


Post Image To Facebook Button

Download

Post Image To Facebook Button

FB.getLoginStatus(function(response){ . function(response) { . function postFeed() { . Sers dirigido a la versin en ingls en 5 segundos. My images are around 2-3 MB each. I have seen a couple of unanswered questions regarding this on stackoverflow, hopefully I can explained myself enough. But actually this snippet was an inspiration to my answer –Matyas May 11 '15 at 8:33 add a comment up vote 1 down vote I seem to have a similar problem, but solutions above didn't work. If your image is on the web, just specify the url param as per the API (and see examples in other answers). FB.api('/me/feed', 'post', wallPost , function(response) { . shareimprove this answer edited May 23 '17 at 10:29 Communityf 11 answered Nov 22 '13 at 21:20 Daniel X Moore 9,43586379 add a comment up vote 2 down vote This still works. "OAuthException" - "(#324) Requires upload file" When I try and research this method all I can find out about is a php method that apears to solve this $facebook->setFileUploadSupport(true); However, I am using JavaScript, it looks like this method might be to do with Facebook Graph permissions, but I already have set the permissions userphotos and publishstream, which I believed are the only ones I should need to perform this operation. }, . But then so little is. Apparently the upload script has a timeout on the facebook side. –David Bullock Feb 15 '11 at 12:05 Hi David, would uploading in the body of a HTTP POST request work if the bytes come from canvas.toDataURL() (assuming we decode the base64)? –Crashalot Apr 18 '12 at 6:25 show 3 more comments up vote 43 down vote Yes, this is possible, i find 2 solutions how to do that and they are very similar to each other, u need just define url parameter to external image url FIRST one using Javascript SDk: var imgURL=" with your external photo url FB.api('/albumid/photos', 'post', { message:'photo description', url:imgURL }, function(response){ if (!response response.error) { alert('Error occured'); } else { alert('Post ID: ' + response.id); } }); and SECOND one using jQuery Post request and FormData: var postMSG="Your message"; var url=' var imgURL=" with your external photo url var formData = new FormData(); formData.append("url",imgURL); $.ajax({ url: url, data: formData, cache: false, contentType: false, processData: false, type: 'POST', success: function(data){ alert("POST SUCCESSFUL"); } }); shareimprove this answer edited Nov 19 '11 at 17:39 answered Nov 19 '11 at 17:28 6841713 I used the second one, it gives me : "$ is not defined" –Arrabi Nov 20 '11 at 9:44 4 ofcource, you need add jquery library;) – Nov 21 '11 at 10:15 2 The first one works fine for me. It's back! Take the 2018 Developer Survey today . // UPLOAD A LOCAL IMAGE FILE, BUT THIS CAN NOT BE DONE WITHOUT USER'S MANUAL OPERATION BECAUSE OF SECURITY REASONS . }); . shareimprove this answer answered Sep 1 '14 at 2:39 Carmela 19519 If someone needs it in the future, this code also works for uploading a file from a input[type=file]. } . // POST A IMAGE WITH DIALOG using FB.api . If the image to be uploaded is accessible via a URL, you could fetch the bytes with XmlHttpRequest. oauth: true, . }); . look it up in your favourite JavaScript reference. link: ' . –K48 Jul 21 '16 at 7:42 add a comment up vote 2 down vote This works: function x(authToken, filename, mimeType, imageData, message) { // this is the multipart/form-data boundary we'll use var boundary = '----ThisIsTheBoundary1234567890'; // let's encode our image file, which is contained in the var var formData = '--' + boundary + 'rn'; formData += 'Content-Disposition: form-data; name="source"; filename="' + filename + '"rn'; formData += 'Content-Type: ' + mimeType + 'rnrn'; for (var i = 0; i < imageData.length; ++i) { formData += String.fromCharCode(imageData[i] & 0xff); } formData += 'rn'; formData += '--' + boundary + 'rn'; formData += 'Content-Disposition: form-data; name="message"rnrn'; formData += message + 'rn'; formData += '--' + boundary + '--rn'; var xhr = new XMLHttpRequest(); xhr.open('POST', ' + authToken, true); xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundary); // Solving problem with sendAsBinary for chrome try { if (typeof XMLHttpRequest.prototype.sendAsBinary == 'undefined') { XMLHttpRequest.prototype.sendAsBinary = function(text) { var data = new ArrayBuffer(text.length); var ui8a = new Uint8Array(data, 0); for (var i = 0; i < text.length; i++) ui8a[i] = (text.charCodeAt(i) & 0xff); this.send(ui8a); } } } catch (e) {} xhr.sendAsBinary(formData); }; shareimprove this answer edited Oct 20 '14 at 15:28 isherwood 33.9k87399 answered Oct 20 '14 at 13:24 Thiago Tecedor 312 While this code may answer the question, it is better to include an explanation of what the code does, and why this is a better way of solving the problem than the other answers. Learn more, including about available controls: Cookies Policy.FacebookJoin or Log Into Facebook Email or PhonePasswordForgot account?Log InDo you want to join Facebook?Sign UpSign UpThis page isn't availableThe link you followed may be broken, or the page may have been removed.Go back to the previous page Go to News Feed Visit our Help CenterEnglish (US)NederlandsFryskPolskiTrkeDeutschFranais (France)EspaolPortugus (Brasil)ItalianoSign UpLog InMessengerFacebook LiteMobileFind FriendsPeoplePagesPlacesGamesLocationsCelebritiesMarketplaceGroupsRecipesSportsLookMomentsInstagramLocalAboutCreate AdCreate PageDevelopersCareersPrivacyCookiesAd ChoicesTermsHelpSettingsActivity Log Facebook 2018. var accessToken; . .. –ObscureRobot Nov 21 '11 at 23:04 This worked for me today. var album = response.data[0]; // Now, upload the image to first found album for easiness. function postImage1() { . . 5a02188284

facebook status how to get likes
facebook home for samsung galaxy note 1
forgot password for blackberry facebook
facebook like button layout types
facebook actualizado para samsung chat
facebook chat availability android
how do u verify your facebook account
what does pbc stand for on facebook
facebook chat software from mobile9
cara download game facebook

schemunilte

Saved by schemunilte

on Jan 09, 18