Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Upload Inline-Images using Graph API Batch Request?
    primarykey
    data
    text
    <p>I'm trying to upload images using Graph API Batch Request, but i'm unable to upload using inline image, can anyone help me please? </p> <p>Batch Request Docs: <a href="https://developers.facebook.com/docs/reference/api/batch/" rel="nofollow">https://developers.facebook.com/docs/reference/api/batch/</a></p> <p>Photo batch uploads: <a href="http://developers.facebook.com/blog/post/493/" rel="nofollow">http://developers.facebook.com/blog/post/493/</a> </p> <p>Photo batch uploads blog post code works fine, but i want to upload images from my server and not from my pc, Ex: /public_html/image/pic.jpg and i'm not sure how i can do it.</p> <p><strong>EDIT:</strong> I'm using PHP SDK 3.0.1</p> <p>Here's my code:</p> <pre><code>&lt;?php CODE WAS CHANGED AND THE PROBLEM IS FIXED ALREADY, SEE THE ANSWER BELOW ?&gt; </code></pre> <p>This is from their docs:</p> <blockquote> <p>Uploading binary data</p> <p>Binary data can be specified as part of the multipart/mime portion of the batch API request. The batch Graph API allows uploading multiple binary items as part of a batch call. In order to do this, you need to add all the binary items as multipart/mime attachments to your request, and need each operation to reference its binary items using the "attached_files" property in the operation. The "attached_files" property can take a comma separated list of attachment names in its value.</p> <p>The following example shows how to upload 2 photos in a single batch call:</p> </blockquote> <pre><code>curl –F ‘access_token=…’ \ -F ‘batch=[{“method”:”POST”, \ “relative_url”:”me/photos”, \ “body”:”message=My cat photo” \ "attached_files":"file1" \ }, {“method”:”POST”, \ “relative_url”:”me/photos”, \ “body”:”message=My dog photo” \ "attached_files":"file2" \ }, ]’ -F ‘file1=@cat.gif’ \ -F 'file2=@dog.jpg' \ https://graph.facebook.com </code></pre> <p><strong>EDIT 2:</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload