Thursday, July 4, 2013

uploaded

WebSpeaks.in | Upload images to Facebook $app_id,, 'secret' => $app_secret, 'fileUpload' => true )); //It can be found at https://developers.facebook.com/tools/access_token/ $access_token = ''; $params = array('access_token' => $access_token); //The id of the fanpage $fanpage = '330299184793'; //The id of the album $album_id ='10150418901414794'; //Replace arvind07 with your Facebook ID $accounts = $facebook->api('/arvind07/accounts', 'GET', $params); foreach($accounts['data'] as $account) { if( $account['id'] == $fanpage || $account['name'] == $fanpage ){ $fanpage_token = $account['access_token']; } } $valid_files = array('image/jpeg', 'image/png', 'image/gif'); if(isset($_FILES) && !empty($_FILES)){ if( !in_array($_FILES['pic']['type'], $valid_files ) ){ echo 'Only jpg, png and gif image types are supported!'; }else{ #Upload photo here $img = realpath($_FILES["pic"]["tmp_name"]); $args = array( 'message' => 'This photo was uploaded via WebSpeaks.in', 'image' => '@' . $img, 'aid' => $album_id, 'no_story' => 1, 'access_token' => $fanpage_token ); $photo = $facebook->api($album_id . '/photos', 'post', $args); if( is_array( $photo ) && !empty( $photo['id'] ) ){ echo 'Click here to watch this photo on Facebook.
'; } } } ?> <!-- Form for uploading the photo

Select a photo to upload on Facebook Fan Page
Select the image:
-->