Google Drive Support #2380
Replies: 4 comments 10 replies
-
please give us more details |
Beta Was this translation helpful? Give feedback.
-
Sure. This requires a little bit of time to setup but I followed these steps to get Google Drive to work with Laravel Storage: Model Code:
Custom PathGenerator
The problem I would run into is that on upload, it would create the folders that I specified and upload the file, however there would also be an additional folder created that would be named the same as the Google Folder ID and I tracked it down to the line of code mentioned above. This is because Google uses the file/folder ID to identify it and not the name of the file/folder (probably similar to S3 which is why it's in that array for exclusion). |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
I'm using with masbug/flysystem-google-drive-ext wihout problems |
Beta Was this translation helpful? Give feedback.
-
First, thanks for creating such a great library!
I'm needing to incorporate Google Drive to store some assets. I have it pretty much working after following these steps and am using a custom PathGenerator class to generate my path as suggested in this closed issue:
#1331
However, when I add media to the model it is creating an additional folder with the name of the Google Folder ID (not the friendly name). I traced it to the following line:
laravel-medialibrary/src/MediaCollections/Filesystem.php
Line 309 in ebbc996
This has to do with how directories are created with the adapter and it needing the Google folder id and not the name of the folder (you can actually have folders with the same name on Google Drive because of this difference).Changing that line to something like the following fixes the issue (assuming the drive is named 'google'):
My ultimate fix was to extend this class and overwrite the method and then in a service provider bind it as in the following example, however, it would be great to not have to do this:
Thanks again!
Beta Was this translation helpful? Give feedback.
All reactions