我試圖爲JPEG圖像上傳到我/做類似於捲曲做了staging_resources:以上如何發佈jpeg圖像到Facebook我/ staging_resources?
curl -X POST \
https://graph.facebook.com/me/staging_resources \
-F "[email protected]/prawn-curry-1.jpg" \
-F "access_token=$USER_ACCESS_TOKEN"
是從Facebook DOC(https://developers.facebook.com/docs/opengraph/using-object-api/#staging)。
我的HTTP請求看起來像這樣:
方法:POST
頭:
內容類型的multipart/form-data的;邊界= Random_Boundary_Chars
BODY:
--Random_Boundary_Chars Content-Disposition: form-data; name="access_token" USER_AUTH_TOKEN --Random_Boundary_Chars Content-Disposition: form-data; name="file" Content-Type: image/jpeg Content-Transfer-Encoding: base64
/9J/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAABAAEDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4 + Tl5ufo6erx8vP09fb3 + PN6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3 + PN6/9oADAMBAAIRAxEAPwD9/KKKKAP/2Q ==
--Random_Boundary_Chars--
的問題是,我總是從服務器獲取這樣的響應:
「WWW驗證:OAuth的 」Facebook平臺「, 」INVALID_REQUEST「」(#100)無效的文件。預期的以下類型之一的文件:image/jpg,image/jpeg,image/gif,image/png「」。
我應該用什麼格式將圖像附加到HTTP請求? (我試過編碼base64,並嘗試使用URL編碼器)。
謝謝