title: Create photo albums and upload photos using the Facebook Graph API
body: <p>I used Facebook graph api to upload photos in facebook from my site using codeigniter.
  <strong><em>But multiple times uploaded same images in facebook.</em></strong>
  My code as follows:</p>
  
  <pre><code># Path to facebook's PHP SDK.       
  
  require_once(APPPATH."libraries/facebook.php");
  
  # Facebook application config.
      // newcheck app [testpurpose ....]
  
  $config = array(
              'appId'      =&gt; 'APP ID',
              'secret'     =&gt; 'SECRET KEY',
              'fileUpload' =&gt; true # Optional and can be set later as well (Using setFileUploadSupport() method).
          );
  
  
  
  # Create a new facebook object.
          $facebook = new Facebook($config);
  
          # Current user ID.
          $user_id = $this-&gt;facebook-&gt;getUser();
  
          # Check to see if we have user ID.
          if($user_id) {
  
              # If we have a user ID, it probably means we have a logged in user.
              # If not, we'll get an exception, which we handle below.
              try {
  
                  # Get the current user access token:
                  $access_token = $this-&gt;facebook-&gt;getAccessToken();
  
                  # Upload photo to the album we've created above:
                  $image_absolute_url = 'http://abc.com/research_social_sites/figures/pie.jpg';
  
                  $photo_details = array();
                  $photo_details['access_token']  = $access_token;
                  $photo_details['url']           = $image_absolute_url;                        # Use this to upload image using an Absolute URL.
                  $photo_details['message']       = 'Your picture message/caption goes here'. date('Y-m-d H:i:s') .'-&gt;BY RLS';
  
                  $upload_photo = $this-&gt;facebook-&gt;api('/me/photos', 'POST', $photo_details);
  
                  # Output photo ID:
                  echo '&lt;br&gt;Photo ID: ' . $upload_photo['id'];
              } catch(FacebookApiException $e) {
                  // If the user is logged out, you can have a 
                  // user ID even though the access token is invalid.
                  // In this case, we'll get an exception, so we'll
                  // just ask the user to login again here.
                  $login_url = $this-&gt;facebook-&gt;getLoginUrl( array('scope' =&gt; 'publish_stream, user_photos')); 
                  echo 'Error Uploading Image &lt;br&gt; Please &lt;a href="' . $login_url . '"&gt;login.&lt;/a&gt;';
                  }   
          } else {
  
              # No user, print a link for the user to login and give the required permissions to perform tasks.
              $params = array(
              'scope' =&gt; 'publish_stream, user_photos', # These permissions are required in order to upload image to user's profile.
              );
  
              $login_url = $this-&gt;facebook-&gt;getLoginUrl($params);
              echo 'You are not Logged in &lt;br&gt; Please &lt;a href="' . $login_url . '"&gt;login.&lt;/a&gt;';
          }
  </code></pre>
  
  <p>But it works fine but main problem is it uploaded file more than one time same image.
  So please help me to give the solution for stopping multiple times uploading images on facebook.
  <strong>Thanks for your coperation.</strong></p>