Error:OAuthException: (#324) Requires upload file .... Please help me out !!!!

2,064 views
Skip to first unread message

aabu0...@gmail.com

unread,
May 9, 2013, 11:12:47 PM5/9/13
to koala...@googlegroups.com
 //html form for uploading the image

 <form enctype="multipart/form-data" action="upload.php" method="POST">
     Please choose a photo:
     <input name="photo" type="file"><br/><br/>
     Say something about this photo:
     <input name="message" type="text" value=""><br/><br/>
    <input type="submit" value="Upload"/><br/>
  </form>

//html form will be redirecting to upload.php

//this is upload.php file ..

    <?php
    //upload.php
    if(isset($_FILES['photo']) && isset($_POST['message'])){

        $uploadfile ='./uploads/'.basename($_FILES['photo']['name']);

      
        $iStats=getimagesize($_FILES['photo']['tmp_name']);

      
        if (isset($iStats['mime']) && $iStats[0]>0) {

        move_uploaded_file($_FILES['photo']['tmp_name'], $uploadfile);
        require_once('sdk/src/facebook.php');
        require_once('utils.php');
        require_once('AppInfo.php');
        try{

//this one is used to find the APPID and secret of the app

            $facebook = new Facebook(array(
                        'appId'  => AppInfo::appID(),
                        'secret' => AppInfo::appSecret(),
                        'sharedSession' => true,
                        'trustForwarded' => true,
                        ));
   
            $album_details = array(
                    'message'=> 'Album desc',
                    'name'=> 'Album name'
                    );


   
            $uid = $facebook->getUser();  //used to get the user id
    
            $me = $facebook->api('/me');

        $token = $facebook->getAccessToken(); //here I get the token from the $session array

            $create_album = $facebook->api('/me/albums', 'post', $album_details);
            
                $album_id = $create_album['id'];
       
            $facebook->setFileUploadSupport(true);
            $args['image'] = '@' . realpath($uploadfile);

         $data = $facebook->api('/'. $album_id . '/photos?access_token='. $token, 'post', $args['image']);

           //     $data = $facebook->api('/'.$album_id.'/photos', 'post', $args['image']);

        } catch(FacebookApiException $e){
            echo "Error:" .$e;
        }
        unlink($uploadfile);
        echo "Success!\n";
        } else {
        echo "Wrong file type!\n";
        }
    }

    ?>

banane

unread,
May 10, 2013, 1:33:30 PM5/10/13
to koala...@googlegroups.com
Output the args['image'] - it's complaining that it doesn't have a file to upload. I also am not sure you need to add an @ to realpath.



--
You received this message because you are subscribed to the Google Groups "Koala & The Facebook Graph API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to koala-users...@googlegroups.com.
To post to this group, send email to koala...@googlegroups.com.
Visit this group at http://groups.google.com/group/koala-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages