Hi guys, please have below code:
$new_user_info = get_user_info_by_user_id($website_user_id);
$new_user_avatar = get_user_media_avatar_image_path($website_user_id);
$mime_type = mime_content_type($new_user_avatar);
$curl_api_call = curl_init($curl_api_url);
curl_setopt($curl_api_call, CURLOPT_POST, TRUE);
curl_setopt($curl_api_call, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl_api_call, CURLOPT_HTTPHEADER, [
'Content-Type: multipart/form-data',
'Authorization: Token ' . $flarum_admin_token
]);
curl_setopt($curl_api_call, CURLOPT_POSTFIELDS, [
'avatar' => curl_file_create($new_user_avatar, 'application/octet-stream', 'avatar')
]);
$curl_api_return = curl_exec($curl_api_call);
checking $mime_type there, returns "image/png".
But API returns error: The avatar must be a file of type: jpeg, png, bmp, gif.
I just migrated to Flarum Beta 13.
When I try to upload avatar via flarum user settings directly, works without problem (same avatar image).
Please any ideas what could be wrong here?
Thanks!