I'm using Gcloud PHP library for uploading files to storage buckets and it
works fine. But I want to track progress from this upload process, trying
to use the uploadProgressCallback option provided and documented here:
https://googlecloudplatform.github.io/google-cloud-php/#/docs/google-cloud/v0.33.0/storage/bucket?method=getResumableUploader
But it's not working, the callable isn't fired at all. I'm new to using
callable functions, but I think it's pretty simple. Here's my code below.
function uploadObject($bucketName, $objectName, $source){
$storage = new StorageClient();
$bytes = 0;
$bucket = $storage->bucket($bucketName);
$uploader = $bucket->getResumableUploader (
$file = fopen($source, 'r'),
[
'name' => $objectName,
'resumable' => true,
'chunkSize' => 524288,
'uploadProgressCallback' => array($this, 'uploadProgress')
]
);
try {
$object = $uploader->upload();
} catch ( GoogleException $ex ) {
$resumeUri = $uploader->getResumeUri();
$object = $uploader->resume($resumeUri);
}
}
function uploadProgress($bytes) {
$_SESSION['uploadProgress'] = $bytes; }
Any help would be greatly appreciated...
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/9538d6db-7ab2-4b77-bbc3-8a5ddbc5e4f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.