flysystem-google-drive icon indicating copy to clipboard operation
flysystem-google-drive copied to clipboard

copy method doesn't return file (or file id)

Open rienheuver opened this issue 6 years ago • 3 comments

The copy-method seems to be the only one that doesn't return the file you created. It's annoying because that way you can't save the file ID to a database. The cloud storage is also too slow to be able to right away find the file again in storage and get the file ID that way.

rienheuver avatar Nov 28 '18 11:11 rienheuver

@rienheuver The return value of the copy method is defined as boolean.

However, you can get metadata using getMetaData() immediately after using the copy method.

if ($filesystem->copy($from, $to)) {
    $metadata = $filesystem->getMetaData($to);
}

nao-pon avatar Nov 28 '18 11:11 nao-pon

In the case i'm creating a folder like this Storage::cloud()->makeDirectory('/' . $branch->BranchName); how will I get the metadata ?

donmbelembe avatar Dec 26 '18 10:12 donmbelembe

I need to get the directory ID

donmbelembe avatar Dec 26 '18 10:12 donmbelembe