Constants

UPLOAD_MEDIA_TYPE

UPLOAD_MEDIA_TYPE

UPLOAD_MULTIPART_TYPE

UPLOAD_MULTIPART_TYPE

UPLOAD_RESUMABLE_TYPE

UPLOAD_RESUMABLE_TYPE

Properties

$mimeType

$mimeType : string

Type

string

$data

$data : string

Type

string

$resumable

$resumable : boolean

Type

boolean

$chunkSize

$chunkSize : integer

Type

integer

$size

$size : integer

Type

integer

$resumeUri

$resumeUri : string

Type

string

$progress

$progress : integer

Type

integer

$request

$request : \Psr\Http\Message\RequestInterface

Type

\Psr\Http\Message\RequestInterface

$boundary

$boundary : string

Type

string

$httpResultCode

$httpResultCode : integer

Result code from last HTTP call

Type

integer

Methods

__construct()

__construct(\Google_Client  $client, \Psr\Http\Message\RequestInterface  $request,   $mimeType,   $data,   $resumable = false, boolean  $chunkSize = false) 

Parameters

\Google_Client $client
\Psr\Http\Message\RequestInterface $request
$mimeType

string

$data

string The bytes you want to upload.

$resumable

bool

boolean $chunkSize

File will be uploaded in chunks of this many bytes. only used if resumable=True

setFileSize()

setFileSize(  $size) 

Set the size of the file that is being uploaded.

Parameters

$size
  • int file size in bytes

getProgress()

getProgress() : integer

Return the progress on the upload

Returns

integer —

progress in bytes uploaded.

nextChunk()

nextChunk(  $chunk = false) 

Send the next part of the file to upload.

Parameters

$chunk

getHttpResultCode()

getHttpResultCode() : integer

Return the HTTP result code from the last call made.

Returns

integer —

code

resume()

resume(  $resumeUri) 

Resume a previously unfinished upload

Parameters

$resumeUri

the resume-URI of the unfinished, resumable upload.

getUploadType()

getUploadType(  $meta) : string

Valid upload types: - resumable (UPLOAD_RESUMABLE_TYPE) - media (UPLOAD_MEDIA_TYPE) - multipart (UPLOAD_MULTIPART_TYPE)

Parameters

$meta

Returns

string

getResumeUri()

getResumeUri() 

setChunkSize()

setChunkSize(  $chunkSize) 

Parameters

$chunkSize

getRequest()

getRequest() 

makePutRequest()

makePutRequest(\Psr\Http\Message\RequestInterface  $request) : false|mixed

Sends a PUT-Request to google drive and parses the response, setting the appropiate variables from the response()

Parameters

\Psr\Http\Message\RequestInterface $request

Returns

false|mixed —

false when the upload is unfinished or the decoded http response

process()

process() : \Psr\Http\Message\RequestInterface

Returns

\Psr\Http\Message\RequestInterface —

$request

fetchResumeUri()

fetchResumeUri() 

transformToUploadUrl()

transformToUploadUrl()