title: aws s3 uploading a directory to a bucket with php sdk
body: <p>This is the php file named upload.php in ec2 server</p>
  
  <pre><code>require 'vendor/autoload.php';
  use Aws\S3\S3Client;
  
  $client = S3Client::factory(array(
              'key' =&gt; 'aws-secret-key',
              'secret' =&gt; 'aws-very-secret-pass',
          ));
  $dir = '/home/user/movies/history';
  $bucket = 'my-unique-bucket';
  $keyPrefix = '';
  $options = array(
      'params'      =&gt; array('ACL' =&gt; 'public-read'),
      'concurrency' =&gt; 20,
      'debug'       =&gt; true
  );
  
  
  
  $client-&gt;uploadDirectory($dir, $bucket, $keyPrefix, $options);
  </code></pre>
  
  <p>When I execute the upload.php file in terminal returns fatal error like this,</p>
  
  <pre><code>PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(/home/kaya/Resimler/transferet/): failed to open dir: No such file or directory' in /var/www/html/vendor/aws/aws-sdk-php/src/Aws/S3/Sync/UploadSyncBuilder.php:47                                             
  Stack trace:
  
  
  
  #0 /var/www/html/vendor/aws/aws-sdk-php/src/Aws/S3/Sync/UploadSyncBuilder.php(47): RecursiveDirectoryIterator-&gt;__construct('/home/user/movie...', 12800)           
  #1 /var/www/html/vendor/aws/aws-sdk-php/src/Aws/S3/S3Client.php(557): Aws\S3\Sync\UploadSyncBuilder-&gt;uploadFromDirectory('/home/user/movie...')                    
  #2 /var/www/html/upload_dir.php(21): Aws\S3\S3Client-&gt;uploadDirectory('/home/user/movie...', 'my-unique-bucket', '', Array)                                                 
  #3 {main}
  
  
  
    thrown in /var/www/html/vendor/aws/aws-sdk-php/src/Aws/S3/Sync/UploadSyncBuilder.php on line 47 
  </code></pre>
  
  <p>Normally I can upload files clearly with php sdk except uploadfolder function. I couldnt find where is false. My php sdk version is 2.7. </p>