title: Fatal error: Uncaught InvalidArgumentException when trying to upload file to AWS
body: <p>I'm trying to create an s3 bucket and then upload a file to it. However, when I run the code I get this ugly error message:</p>
  <blockquote>
  <p>Fatal error: Uncaught InvalidArgumentException: Found 1 error while
  validating the input provided for the PutObject operation: [Body] must
  be an fopen resource, a GuzzleHttp\Stream\StreamInterface object, or
  something that can be cast to a string. Found bool(false) in
  /Users/ddripz/Downloads/vendor/aws/aws-sdk-php/src/Api/Validator.php:65</p>
  </blockquote>
  <p>Stack trace:</p>
  <pre><code>#0 /Users/ddripz/Downloads/vendor/aws/aws-sdk-php/src/Middleware.php(78): Aws\Api\Validator-&gt;validate('PutObject', Object(Aws\Api\StructureShape), Array) 
  #1 /Users/ddripz/Downloads/vendor/aws/aws-sdk-php/src/S3/S3Client.php(541): Aws\Middleware::Aws\{closure}(Object(Aws\Command), NULL) 
  #2 /Users/ddripz/Downloads/vendor/aws/aws-sdk-php/src/S3/S3Client.php(564): Aws\S3\S3Client::Aws\S3\{closure}(Object(Aws\Command), NULL) 
  #3 /Users/ddripz/Downloads/vendor/aws/aws-sdk-php/src/S3/S3Client.php(498): Aws\S3\S3Client::Aws\S3\{closure}(Object(Aws\Command), NULL) 
  #4 /Users/ddripz/Downloads/vendor/aws/aws-sdk-php/src/S3/S3Client.php(517) in /Users/ddripz/Downloads/vendor/aws/aws-sdk-php/src/Api/Validator.php on line 65
  </code></pre>
  <p>Here is my PHP code:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  // Require the Composer autoloader.
  require '/Users/ddripz/Downloads/vendor/autoload.php';
  
  use Aws\S3\S3Client;
  
  // Instantiate an Amazon S3 client.
  $s3 = new S3Client([
      'version' =&gt; 'latest',
      'region'  =&gt; 'us-west-2',
      'credentials' =&gt; [
        'key' =&gt; 'API KEY',
        'secret' =&gt; 'SECRET KEY'
      ]
  ]);
  
  $bucketname = 'we-sign-file-manager';
  $file_path = '/Users/DennisWarfield/Desktop/wesign/uploads/5f31fc30410c17.68431957.jpg';
  $key = basename($file_path);
  
  try {
      $s3-&gt;putObject([
          'Bucket' =&gt; '',
          'Key'    =&gt; 'my-object',
          'Body'   =&gt; fopen('/path/to/file', 'r'),
          'ACL'    =&gt; 'public-read',
      ]);
  } catch (Aws\S3\Exception\S3Exception $e) {
      echo &quot;There was an error uploading the file.\n&quot;;
  }
  
   ?&gt;
  </code></pre>
  <p>Any idea why this is happening?</p>
  <p>Also, I'm confused as to why the error is occurring on line <code>65</code> when the max number of lines in my php file is 32.</p>
  <p>Is my <code>autoload.php</code> path incorrect because the file is in downloads?</p>