我正在尝试制作一个 facebook 应用程序,将照片从计算机上传到 facebook 上的特定相册。我有以下代码,但出现错误:创建表单数据失败。
require_once 'include.php';
$config = array(
'appId' => $app_id,
'secret' => $app_secret,
);
$facebook = new Facebook($config);
$user = $facebook->getUser();
if($user && isset($_POST['submit'])){
try {
$facebook->setFileUploadSupport(true);
//Create an album
$album_details = array(
'message'=> 'Album desc',
'name'=> 'Album name'
);
$create_album = $facebook->api('/me/albums', 'POST', $album_details);
//Get album ID of the album you've just created
$album_uid = $create_album['id'];
//Upload a photo to album of ID...
$photo = realpath($_FILES['miss_photo']['tmp_name']);
$photo2 = $photo . '.jpg';
//echo $photo2; exit();
$photo_details['image'] = '@' . $photo2;
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'POST', $photo_details);
} catch (FacebookApiException $e) {
echo ($e->getMessage());
}
}
else
echo 'error';
知道为什么我会收到错误消息吗?