Matheus Castanheira
Matheus Castanheira

Reputation: 11

Error response from the Facebook API using HTTP POST request with multipart form-data

I'm using the Facebook Graph API inside an Unreal Engine 4 project. I'm trying to implement the photo upload. The method I'm using is the multipart form data.

Here is the response I'm receiving:

response={"error":{"message":"Invalid parameter","type" :"OAuthException","code":100,"error_subcode":1366046,"is_transient":false,"error_user_title":"Can't Read Files","error_user_msg":"Your photos couldn't be uploaded. Photos should be less than 4 MB and saved as JPG, PNG, GIF or TIFF files.","fbtrace_id":"AaAcYvfdWM/"}}

ps: The file is less than 4 MB.

HTTP request URL

https://graph.facebook.com/me/photos…{my user token}

HTTP request format

contentType: multipart/form-data; boundary=----------UE4AdvancedFB

------------UE4AdvancedFB

Content-Disposition: form-data; name="source"; filename="sf.jpg"

Content-Type: image/jpeg

{byte data}

------------UE4AdvancedFB--

A important thing to notice is that I don't actually have a file here, but only bytes (coming from a game texture).

What should I do if I only want to send bytes but don't actually have a file? (what should be the Content-Disposition filename? And the Content-Type?)

Any thoughts about the error response?

Thanks!

Upvotes: 1

Views: 866

Answers (1)

Matheus Castanheira
Matheus Castanheira

Reputation: 11

The request is actually right. The problem was the image data sent. The conversion from the game texture to byte data was actually resulting in a size greater than the maximum 4 MB.

Thanks.

Upvotes: 0

Related Questions