Ecommerce Shopify WordPress Discussion

WordPress Google Storage Upload

I am developing a Wordpress plugin and wanted to upload to my Google Cloud Storage bucket from a form. I can do this quite easily using HTML forms here: https://cloud.google.com/storage/docs/xml-api/post-object-forms#html However, when I try the PHP code snippet, I get a critical error. I used composer to install the Google StorageClient library with composer require google/cloud-storage . When I try to use generateSignedPostPolicyV4 as the PHP example suggests, I get a critical error instead of uploading the file as with the HTML form. Could someone please let me know why using the PHP library generates an error? Code below: use Google\Cloud\Storage\StorageClient; require __DIR__ . '/vendor/autoload.php'; $storage = new StorageClient(); $bucket = $storage->bucket('uploads'); $response = $bucket->generateSignedPostPolicyV4( 'test-object', new \DateTime('10 min'), [ 'fields' => [ 'x-goog-meta-test' => 'data' ] ] ); I've tested up to the $response variable, and everything works until that line. Thanks in advance. As with the HTML form example, the end result should be an uploaded file
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.