With the same access token as the one I used to create a page event, I tried to upload a photo to it with the PHP SDK 3.1.1
The checklist:
- I am passing an access token
- The access token I’m passing does have create_event, publish_stream, photo_upload
- I am making a call to /EVENT_ID/picture
- I am using the method POST
- The params do contain the needed access token and source=@ABSOLUTE_PATH_TO_IMAGE
- File upload support is turned on for the PHP SDK object
What I have tried previously (mostly seperately)
- Trying to upload a picture within the same params of the request for creating the event, with the source param, using @ before the full image file path
- The same, but instead of using the param “source”, I tried
$params[basename($file)] = '@' . $file; - Trying to add a picture to /EVENT_ID/picture, but with url = URL_TO_FILE instead of source = @ABSOLUTE_PATH_TO_FILE (results in the exact same error, “An unknown error has occured”
- Adding a message param with text to the params where I upload the picture separately from creating the event
- Adding venue=null to the params for where I create the event
- I have tried using the latest Facebook SDK PHP files
Here is a PHP var_dump() of the two requests:
array(6) {
["name"]=>
string(11) "Superman IV"
["start_time"]=>
string(24) "2012-09-23T16:00:00+0200"
["end_time"]=>
string(24) "2012-09-23T17:30:00+0200"
["description"]=>
string(237) "Lex Luther wykrada z muzeum włosy Supermana. Dzięki nim udaje mu się stworzyć super robota, Nuclear Mana, który potrafi czerpać energię ze słońca. Dzięki temu Nuclear Man staje się niezniszczalny i staje do walki z Supermanem."
["access_token"]=>
string(118) "<censored>"
["@event_cover.jpg"]=>
string(61) "@/var/www/rr048_attila/templates/template/img/event_cover.jpg"
}
array(2) {
["access_token"]=>
string(118) "<censored>"
["source"]=>
string(61) "@/var/www/rr048_attila/templates/template/img/event_cover.jpg"
}
Note that for the @event_cover.jpg param, I tried doing the same without the @ in the key, and also without that param at all.
Here is a var_dump() of the error I get for the second request:
array(2) {
["error_code"]=>
int(1)
["error_msg"]=>
string(25) "An unknown error occurred"
}
Does anyone have any idea what is causing this problem, or what I forgot to do?
At the moment, this can be affected by Facebook bug. I am tracking it here
Also I’ve created similar question, from my point of view, but no one answered it.
(question can be found here)
The issue can be connected to Timezone Migration, because before that my events and picture upload to them worked properly and no changes to script were made.