runtime: php
GCS file uploading process:
$storage = new StorageClient();
$file = fopen($source, 'r');
$bucket = $storage->bucket($bucketName);
$object = $bucket->upload($file, [
'name' => $objectName
]);
Now i want to create object with dynamic text/pdf instead of using $source
path file.
for example:
$storage = new StorageClient();
$objectName = "newfile.txt";
$content = "This is the dynamic content";
$bucket = $storage->bucket($bucketName);
$object = $bucket->upload($content, [
'name' => 'textDocs/'.$objectName
]);
so it'll create new object as "newfile.txt" with content "This is the dynamic content".
is there any cloud libraries or functions to process this?
thanks in advance
For Dynamic creation of text document (with-dynamic-content) in Google-cloud-storage, below code will be work perfectly.
For Dynamic creation of pdf document (with-dynamic-content) in Google-cloud-storage.