Large file upload to google cloud storage using PHP

放肆的年华 提交于 2019-12-11 16:19:15

问题


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);
}

来源:https://stackoverflow.com/questions/51191907/large-file-upload-to-google-cloud-storage-using-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!