Documentation

UploadBuilder extends AbstractUploadBuilder
in package

Easily create a multipart uploader used to quickly and reliably upload a large file or data stream to Amazon S3 using multipart uploads

Table of Contents

Properties

$calculateEntireMd5  : bool
$calculatePartMd5  : bool
$client  : AwsClientInterface
$commandOptions  : array<string|int, mixed>
$concurrency  : int
$headers  : array<string|int, mixed>
$md5  : string
$minPartSize  : int
$source  : EntityBody
$state  : TransferStateInterface
$transferOptions  : array<string|int, mixed>

Methods

addOptions()  : $this
Add an array of options to pass to the initial CreateMultipartUpload operation
build()  : TransferInterface
Build the appropriate uploader based on the builder options
calculateMd5()  : $this
Set to true to have the builder calculate the MD5 hash of the entire data source before initiating a multipart upload (this could be an expensive operation). This setting can ony be used with seekable data sources.
calculatePartMd5()  : $this
Specify whether or not to calculate the MD5 hash of each uploaded part.
newInstance()  : static
Return a new instance of the UploadBuilder
resumeFrom()  : $this
Set the state of the upload. This is useful for resuming from a previously started multipart upload.
setAcp()  : $this
Set the ACP to use on the object
setBucket()  : $this
Set the bucket to upload the object to
setClient()  : $this
Set the client used to connect to the AWS service
setConcurrency()  : $this
Set the concurrency level to use when uploading parts. This affects how many parts are uploaded in parallel. You must use a local file as your data source when using a concurrency greater than 1
setHeaders()  : $this
Specify the headers to set on the upload
setKey()  : $this
Set the key of the object
setMd5()  : $this
Explicitly set the MD5 hash of the entire body
setMinPartSize()  : $this
Set the minimum acceptable part size
setOption()  : $this
Set an option to pass to the initial CreateMultipartUpload operation
setSource()  : $this
Set the data source of the transfer
setTransferOptions()  : $this
Set an array of transfer options to apply to the upload transfer object
initiateMultipartUpload()  : TransferStateInterface
Initiate the multipart upload

Properties

$calculateEntireMd5

protected bool $calculateEntireMd5 = false

Whether or not to calculate the entire MD5 hash of the object

$calculatePartMd5

protected bool $calculatePartMd5 = true

Whether or not to calculate MD5 hash of each part

$commandOptions

protected array<string|int, mixed> $commandOptions = array()

Array of initiate command options

$concurrency

protected int $concurrency = 1

Concurrency level to transfer the parts

$headers

protected array<string|int, mixed> $headers = array()

Array of headers to set on the object

$md5

protected string $md5

MD5 hash of the entire body to transfer

$minPartSize

protected int $minPartSize = \Aws\S3\Model\MultipartUpload\AbstractTransfer::MIN_PART_SIZE

Minimum part size to upload

$transferOptions

protected array<string|int, mixed> $transferOptions = array()

Array of transfer options

Methods

addOptions()

Add an array of options to pass to the initial CreateMultipartUpload operation

public addOptions(array<string|int, mixed> $options) : $this
Parameters
$options : array<string|int, mixed>

Array of CreateMultipartUpload operation parameters

Return values
$this

calculateMd5()

Set to true to have the builder calculate the MD5 hash of the entire data source before initiating a multipart upload (this could be an expensive operation). This setting can ony be used with seekable data sources.

public calculateMd5(bool $calculateMd5) : $this
Parameters
$calculateMd5 : bool

Set to true to calculate the MD5 hash of the body

Return values
$this

calculatePartMd5()

Specify whether or not to calculate the MD5 hash of each uploaded part.

public calculatePartMd5(bool $usePartMd5) : $this

This setting defaults to true.

Parameters
$usePartMd5 : bool

Set to true to calculate the MD5 has of each part

Return values
$this

newInstance()

Return a new instance of the UploadBuilder

public static newInstance() : static
Return values
static

resumeFrom()

Set the state of the upload. This is useful for resuming from a previously started multipart upload.

public resumeFrom(TransferStateInterface|string $state) : $this

You must use a local file stream as the data source if you wish to resume from a previous upload.

Parameters
$state : TransferStateInterface|string

Pass a TransferStateInterface object or the ID of the initiated multipart upload. When an ID is passed, the builder will create a state object using the data from a ListParts API response.

Return values
$this

setAcp()

Set the ACP to use on the object

public setAcp(Acp $acp) : $this
Parameters
$acp : Acp

ACP to set on the object

Return values
$this

setBucket()

Set the bucket to upload the object to

public setBucket(string $bucket) : $this
Parameters
$bucket : string

Name of the bucket

Return values
$this

setConcurrency()

Set the concurrency level to use when uploading parts. This affects how many parts are uploaded in parallel. You must use a local file as your data source when using a concurrency greater than 1

public setConcurrency(int $concurrency) : $this
Parameters
$concurrency : int

Concurrency level

Return values
$this

setHeaders()

Specify the headers to set on the upload

public setHeaders(array<string|int, mixed> $headers) : $this
Parameters
$headers : array<string|int, mixed>

Headers to add to the uploaded object

Return values
$this

setKey()

Set the key of the object

public setKey(string $key) : $this
Parameters
$key : string

Key of the object to upload

Return values
$this

setMd5()

Explicitly set the MD5 hash of the entire body

public setMd5(string $md5) : $this
Parameters
$md5 : string

MD5 hash of the entire body

Return values
$this

setMinPartSize()

Set the minimum acceptable part size

public setMinPartSize(int $minSize) : $this
Parameters
$minSize : int

Minimum acceptable part size in bytes

Return values
$this

setOption()

Set an option to pass to the initial CreateMultipartUpload operation

public setOption(string $name, string $value) : $this
Parameters
$name : string

Option name

$value : string

Option value

Return values
$this

setSource()

Set the data source of the transfer

public setSource(resource|string|EntityBody $source) : $this
Parameters
$source : resource|string|EntityBody

Source of the transfer. Pass a string to transfer from a file on disk. You can also stream from a resource returned from fopen or a Guzzle EntityBody object.

Tags
throws
InvalidArgumentException

when the source cannot be found or opened

Return values
$this

setTransferOptions()

Set an array of transfer options to apply to the upload transfer object

public setTransferOptions(array<string|int, mixed> $options) : $this
Parameters
$options : array<string|int, mixed>

Transfer options

Return values
$this

        
On this page

Search results