Large file upload to google cloud storage using PH

2019-08-26 05:48发布

I'm trying to upload large files from server to cloud storage (files over 500mb) and I'm getting PHP time outs. I've tried looking at the Google Client Library documentation and I've crawled through stackoverflow, but I can't find anything that could help me. Also is there any way of tracking the progress of the upload?

Here's the code I'm using at the moment:

$options = [
    'resumable' => true,
    'chunkSize' => 524288
];
$uploader = $bucket->getResumableUploader(
    fopen('uploads/' . $name, 'r'),
    $options
);

try {
    $object = $uploader->upload();
} catch (GoogleException $ex) {
    $resumeUri = $uploader->getResumeUri();
    $object = $uploader->resume($resumeUri);
}

0条回答
登录 后发表回答