Read by filename - File not found
Closed this issue ยท 4 comments
I am trying to read file by filename like $filesystem->read('test.txt')
, but I am getting League\Flysystem\FileNotFoundException
instead of file context.
When I list contents, I am seeing
(int) 11 => [
'type' => 'file',
'path' => '0BwU--KIyWn8kYXl4cE1FajFEYzQ',
'filename' => 'test',
'extension' => 'txt',
'timestamp' => (int) 1499432201,
'mimetype' => 'text/plain',
'size' => (int) 4,
'dirname' => '',
'basename' => '0BwU--KIyWn8kYXl4cE1FajFEYzQ'
],
Then I tried to do $filesystem->read('0BwU--KIyWn8kYXl4cE1FajFEYzQ')
which returns context.
As far as I understand you need to pass google drive file ID instead of human readable path to the file. This makes read
method quite useless because you need to listContents
first and find file you want to read.
@LubosRemplik As you say, GoogleDrive is an item ID based file system. Since it permits the existence of items with the same file name, it is impossible to identify items by just the file name.
Hi!
See my package https://github.com/private-it/flysystem-google-drive
It's wrap over nao-pon/flysystem-google-drive.
You can write and read by file path.
See example: https://github.com/private-it/flysystem-google-drive/blob/master/examples/test.php