I want to upload files to Google Cloud Storage (Bucket) through my PHP or JavaScript application which is hosted in my localhost or external server.
As I tried the Goog
I wrote a package to download / get local file and upload to Google Cloud Storage, maybe it help you: https://github.com/jeansouzak/duf
use JeanSouzaK\Duf\Duff;
use JeanSouzaK\Duf\Prepare\WebResource;
use JeanSouzaK\Duf\Prepare\LocalResource;
$duf = Duff::getInstance(Duff::GOOGLE_CLOUD_STORAGE, [
'project_id' => 'storage-test-227305',
'key_path' => '/home/env/storage-test-227305-8472347a39489.json'
]);
// - Chaining example -
$uploadResults = $duf->prepare([
new LocalResource('imagem', '/home/test/images/test.jpg'),
new WebResource('teste.png', 'https://dummyimage.com/600x400/000/fff')
])->download()->addBucket('your-bucket-name')->upload();