Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
Google_Http_MediaFileUpload Class Reference

Manage large file uploads, which may be media but can be any type of sizable data. More...

Public Member Functions

 __construct (Google_Client $client, Google_Http_Request $request, $mimeType, $data, $resumable=false, $chunkSize=false, $boundary=false)
 
 getHttpResultCode ()
 Return the HTTP result code from the last call made.
 
 getProgress ()
 Return the progress on the upload.
 
 getResumeUri ()
 
 getUploadType ($meta)
 Valid upload types:
 
 nextChunk ($chunk=false)
 Send the next part of the file to upload.
 
 resume ($resumeUri)
 Resume a previously unfinished upload.
 
 setChunkSize ($chunkSize)
 
 setFileSize ($size)
 Set the size of the file that is being uploaded.
 

Public Attributes

const UPLOAD_MEDIA_TYPE = 'media'
 
const UPLOAD_MULTIPART_TYPE = 'multipart'
 
const UPLOAD_RESUMABLE_TYPE = 'resumable'
 

Detailed Description

Manage large file uploads, which may be media but can be any type of sizable data.

Constructor & Destructor Documentation

◆ __construct()

Google_Http_MediaFileUpload::__construct ( Google_Client $client,
Google_Http_Request $request,
$mimeType,
$data,
$resumable = false,
$chunkSize = false,
$boundary = false )
Parameters
$mimeTypestring
$datastring The bytes you want to upload.
$resumablebool
bool$chunkSizeFile will be uploaded in chunks of this many bytes. only used if resumable=True

Member Function Documentation

◆ getHttpResultCode()

Google_Http_MediaFileUpload::getHttpResultCode ( )

Return the HTTP result code from the last call made.

Return values
intcode

◆ getProgress()

Google_Http_MediaFileUpload::getProgress ( )

Return the progress on the upload.

Return values
intprogress in bytes uploaded.

◆ getUploadType()

Google_Http_MediaFileUpload::getUploadType ( $meta)

Valid upload types:

  • resumable (UPLOAD_RESUMABLE_TYPE)
  • media (UPLOAD_MEDIA_TYPE)
  • multipart (UPLOAD_MULTIPART_TYPE)
    Parameters
    $meta
    Return values
    string@visible for testing

◆ nextChunk()

Google_Http_MediaFileUpload::nextChunk ( $chunk = false)

Send the next part of the file to upload.

Parameters
[$chunk]the next set of bytes to send. If false will used $data passed at construct time.

◆ resume()

Google_Http_MediaFileUpload::resume ( $resumeUri)

Resume a previously unfinished upload.

Parameters
$resumeUrithe resume-URI of the unfinished, resumable upload.

◆ setFileSize()

Google_Http_MediaFileUpload::setFileSize ( $size)

Set the size of the file that is being uploaded.

Parameters
$size- int file size in bytes

The documentation for this class was generated from the following file: