Closed clickervinod closed 5 years ago
Hi,
It seems like you are trying to upload to a folder called Example-Company
.
Because Google Drive allows for duplicate file/directory names, you need to use the unique file/folder ID instead of the real name. Are you doing this?
The root directory should be null
for the top level or an ID for any subdirectory.
What did you put in your .env
file under GOOGLE_DRIVE_FOLDER_ID
?
Hi Yes i have added folder id Local backup is working but google backup not working
Hi, See this Comment https://github.com/spatie/laravel-backup/issues/777#issuecomment-433826777
Hi,
My guess is that the backup package is trying to read/put/delete specific filenames (I think it tries to delete old ones?). Then it's not going to work since Google needs ID's, not paths/filenames. But I would need to try this out myself to investigate.
The whole ID system of Google Drive is something I really dislike. It makes working with files so much more complicated. And who would ever want to create 2 identical files? Unfortunately, it is what it is.
To be honest, I would rather use Dropbox for things like this. Spatie has a driver for Dropbox too.
You can fix this issue by sending the backup folder name blank in the 'backup'=>[] array in backup.php file, as google drive doesn't recognize the folders by their names. Alternatively, you can use google drive api to get the name of the folder. So you will replace 'name' => env('APP_NAME', 'laravel-backup'), by 'name' => ''
The backup.php file will look something like this.
`<?php return [
'backup' => [
/*
* The name of this application. You can use this name to monitor
* the backups.
*/
'name' => '',
'source' => [`
Hi,
Local backup is working using spatie/laravel-backup but in google backup iam getting beloow error,
Exception message: { "error": { "errors": [ { "domain": "global", "reason": "notFound", "message": "File not found: Example-Company.", "locationType": "parameter", "location": "fileId" } ], "code": 404, "message": "File not found:Example-Company
Filesystem.php
'google' => [ 'driver' => 'google', 'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'), 'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'), 'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'), 'folderId' => env('GOOGLE_DRIVE_FOLDER_ID'), ],
config/backup.php `<?php
return [
]; ` provider
`<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class GoogleDriveServiceProvider extends ServiceProvider { /**
@return void */ public function boot() { \Storage::extend('google', function ($app, $config) { $client = new \Google_Client(); $client->setClientId($config['clientId']); $client->setClientSecret($config['clientSecret']); $client->refreshToken($config['refreshToken']); $service = new \Google_Service_Drive($client); $adapter = new \Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter($service, $config['folderId']); return new \League\Flysystem\Filesystem($adapter); }); }
/**
where i am wrong
help