src/Bynder/Api/Impl/Upload/AmazonApi.php
public function uploadPartToAmazon(
        $filePath,
        $uploadEndpoint,
        $uploadRequestInfo,
        $chunkNumber,
        $chunk,
        $numberOfChunks
    ) {
        $finalKey = sprintf("%s/p%d", $uploadRequestInfo['multipart_params']['key'], $chunkNumber);
        $formData = [
            self::getFormDataParams('x-amz-credential', $uploadRequestInfo['multipart_params']['x-amz-credential']),
            self::getFormDataParams('X-Amz-Signature', $uploadRequestInfo['multipart_params']['X-Amz-Signature']),
            self::getFormDataParams('x-amz-algorithm', $uploadRequestInfo['multipart_params']['x-amz-algorithm']),
            self::getFormDataParams('x-amz-date', $uploadRequestInfo['multipart_params']['x-amz-date']),
            self::getFormDataParams('Policy', $uploadRequestInfo['multipart_params']['Policy']),
            self::getFormDataParams('key', $finalKey),
            self::getFormDataParams('acl', $uploadRequestInfo['multipart_params']['acl']),
            self::getFormDataParams('success_action_status',
                $uploadRequestInfo['multipart_params']['success_action_status']),
            self::getFormDataParams('Content-Type', $uploadRequestInfo['multipart_params']['Content-Type']),
            self::getFormDataParams('name', $filePath),
            self::getFormDataParams('chunk', $chunkNumber),
            self::getFormDataParams('chunks', $numberOfChunks),
            self::getFormDataParams('Filename', $finalKey),
            self::getFormDataParams('file', $chunk)
        ];

        $stack = HandlerStack::create(new CurlHandler());
        $oauthRequestClient = new Client([
            'base_uri' => $uploadEndpoint,
            'handler' => $stack,
        ]);

        return $oauthRequestClient->postAsync($uploadEndpoint, ['multipart' => $formData])
            ->then(
                function (ResponseInterface $response) {
                    return json_decode($response->getBody(), true);
                }
            );
    }
public function uploadPartToAmazon(
        $filePath,
        $uploadEndpoint,
        $uploadRequestInfo,
        $chunkNumber,
        $chunk,
        $numberOfChunks
    ) {
        $finalKey = sprintf("%s/p%d", $uploadRequestInfo['multipart_params']['key'], $chunkNumber);
        $formData = [
            self::getFormDataParams('x-amz-credential', $uploadRequestInfo['multipart_params']['x-amz-credential']),
            self::getFormDataParams('X-Amz-Signature', $uploadRequestInfo['multipart_params']['X-Amz-Signature']),
            self::getFormDataParams('x-amz-algorithm', $uploadRequestInfo['multipart_params']['x-amz-algorithm']),
            self::getFormDataParams('x-amz-date', $uploadRequestInfo['multipart_params']['x-amz-date']),
            self::getFormDataParams('Policy', $uploadRequestInfo['multipart_params']['Policy']),
            self::getFormDataParams('key', $finalKey),
            self::getFormDataParams('acl', $uploadRequestInfo['multipart_params']['acl']),
            self::getFormDataParams('success_action_status',
                $uploadRequestInfo['multipart_params']['success_action_status']),
            self::getFormDataParams('Content-Type', $uploadRequestInfo['multipart_params']['Content-Type']),
            self::getFormDataParams('name', $filePath),
            self::getFormDataParams('chunk', $chunkNumber),
            self::getFormDataParams('chunks', $numberOfChunks),
            self::getFormDataParams('Filename', $finalKey),
            self::getFormDataParams('file', $chunk)
        ];

        $stack = HandlerStack::create(new CurlHandler());
        $oauthRequestClient = new Client([
            'base_uri' => $uploadEndpoint,
            'handler' => $stack,
        ]);

        return $oauthRequestClient->postAsync($uploadEndpoint, ['multipart' => $formData])
            ->then(
                function (ResponseInterface $response) {
                    return json_decode($response->getBody(), true);
                }
            );
    }
public function uploadPartToAmazon ( $ filePath , $ uploadEndpoint , $ uploadRequestInfo , $ chunkNumber , $ chunk , $ numberOfChunks ) { $ finalKey = sprintf ( "%s/p%d" , $ uploadRequestInfo [ 'multipart_params' ] [ 'key' ] , $ chunkNumber ) ; $ formData = [ self :: getFormDataParams ( 'x-amz-credential' , $ uploadRequestInfo [ 'multipart_params' ] [ 'x-amz-credential' ] ) , self :: getFormDataParams ( 'X-Amz-Signature' , $ uploadRequestInfo [ 'multipart_params' ] [ 'X-Amz-Signature' ] ) , self :: getFormDataParams ( 'x-amz-algorithm' , $ uploadRequestInfo [ 'multipart_params' ] [ 'x-amz-algorithm' ] ) , self :: getFormDataParams ( 'x-amz-date' , $ uploadRequestInfo [ 'multipart_params' ] [ 'x-amz-date' ] ) , self :: getFormDataParams ( 'Policy' , $ uploadRequestInfo [ 'multipart_params' ] [ 'Policy' ] ) , self :: getFormDataParams ( 'key' , $ finalKey ) , self :: getFormDataParams ( 'acl' , $ uploadRequestInfo [ 'multipart_params' ] [ 'acl' ] ) , self :: getFormDataParams ( 'success_action_status' , $ uploadRequestInfo [ 'multipart_params' ] [ 'success_action_status' ] ) , self :: getFormDataParams ( 'Content-Type' , $ uploadRequestInfo [ 'multipart_params' ] [ 'Content-Type' ] ) , self :: getFormDataParams ( 'name' , $ filePath ) , self :: getFormDataParams ( 'chunk' , $ chunkNumber ) , self :: getFormDataParams ( 'chunks' , $ numberOfChunks ) , self :: getFormDataParams ( 'Filename' , $ finalKey ) , self :: getFormDataParams ( 'file' , $ chunk ) ] ; $ stack = HandlerStack :: create ( new CurlHandler ( ) ) ; $ oauthRequestClient = new Client ( [ 'base_uri' => $ uploadEndpoint , 'handler' => $ stack , ] ) ; return $ oauthRequestClient -> postAsync ( $ uploadEndpoint , [ 'multipart' => $ formData ] ) -> then ( function ( ResponseInterface $ response ) { return json_decode ( $ response -> getBody ( ) , true ) ; } ) ; }
Uploads a chunk of a file to an S3 bucket using multipart upload.

@param $filePath
@param $uploadEndpoint
@param $uploadRequestInfo
@param $chunkNumber
@param $chunk
@param $numberOfChunks
@return \GuzzleHttp\Promise\PromiseInterface
Uploads a chunk of a file to an S3 bucket using multipart upload .