title: Uploading file to S3 using presigned URL in PHP
body: <p>I am developing a Web Application using PHP. In my application, I need to upload the file to the AWS S3 bucket using Presigned URL. Now, I can read the private file from the S3 bucket using pre-signed like this.</p>
  
  <pre><code>$s3Client = new S3Client([
              'version' =&gt; 'latest',
              'region' =&gt; env('AWS_REGION', ''),
              'credentials' =&gt; [
                  'key' =&gt; env('AWS_IAM_KEY', ''),
                  'secret' =&gt; env('AWS_IAM_SECRET', '')
              ]
          ]);
  
              //GetObject
          $cmd = $s3Client-&gt;getCommand('GetObject', [
                  'Bucket' =&gt; env('AWS_BUCKET',''),
                  'Key'    =&gt; 'this-is-uploaded-using-presigned-url.png'
              ]);
  
          $request = $s3Client-&gt;createPresignedRequest($cmd, '+20 minutes');
  
  
          //This is for reading the image. It is working.
          $presignedUrl = (string) $request-&gt;getUri();
  </code></pre>
  
  <p>When I access the <code>$presignedUrl</code> from the browser, I can get the file from the s3. It is working. But now, I am uploading a file to S3. Not reading the file from s3. Normally, I can upload the file to the S3 like this.</p>
  
  <pre><code>$client-&gt;putObject(array(
      'Bucket' =&gt; $bucket,
      'Key'    =&gt; 'data.txt',
      'Body'   =&gt; 'Hello!'
  ));
  </code></pre>
  
  <p>The above code is not using the pre-signed URL. But I need to upload the file using a pre-signed URL. How, can I upload the file using a pre-signed URL. For example, what I am thinking is something like this.</p>
  
  <pre><code>$client-&gt;putObject(array(
          'presigned-url' =&gt; 'url'
          'Bucket' =&gt; $bucket,
          'Key'    =&gt; 'data.txt',
          'Body'   =&gt; 'Hello!'
      ));
  </code></pre>
  
  <p>How can I upload?</p>