/**
  * Constructs the PostObject.
  *
  * @param S3ClientInterface $client     Client used with the POST object
  * @param string            $bucket     Bucket to use
  * @param array             $formInputs Associative array of form input
  *                                      fields.
  * @param string|array      $jsonPolicy JSON encoded POST policy document.
  *                                      The policy will be base64 encoded
  *                                      and applied to the form on your
  *                                      behalf.
  */
 public function __construct(S3ClientInterface $client, $bucket, array $formInputs, $jsonPolicy)
 {
     $this->client = $client;
     $this->bucket = $bucket;
     if (is_array($jsonPolicy)) {
         $jsonPolicy = json_encode($jsonPolicy);
     }
     $this->jsonPolicy = $jsonPolicy;
     $this->formAttributes = ['action' => $this->generateUri(), 'method' => 'POST', 'enctype' => 'multipart/form-data'];
     $this->formInputs = $formInputs + ['key' => '${filename}'];
     $credentials = $client->getCredentials()->wait();
     $this->formInputs += $this->getPolicyAndSignature($credentials);
 }