0
我正在嘗試製作一個Facebook應用程序,將照片從計算機上傳到Facebook上的特定專輯。我有下面的代碼,但我得到一個錯誤:創建formpost數據失敗。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';
任何想法,爲什麼我得到的錯誤信息?
沒有,錯誤失敗創建formpost數據和肯定是對的文件名。但是什麼? – dana 2012-04-10 10:22:04
您是否將文件從臨時文件夾移到了真實的地方? – BenOfTheNorth 2012-04-10 10:55:14
nope。這可能是問題? – dana 2012-04-10 11:12:46