Php 使用Laravel 5.4将现有文件上载到google drive时出错
我用的是Laravel 5.4。我正在尝试使用将文件上载到google drivePhp 使用Laravel 5.4将现有文件上载到google drive时出错,php,laravel,laravel-5,database-backups,Php,Laravel,Laravel 5,Database Backups,我用的是Laravel 5.4。我正在尝试使用将文件上载到google drive Storage::disk('google')->put('file.txt','hello world') 使用上述方法,在Google Drive文件夹中创建名为“file.txt”的文件。但我必须上传一个现有的zip文件 我正在使用下面的代码在google drive中上传zip文件 Storage::disk('google')->put('RandomFileName.zip',Storage_path
Storage::disk('google')->put('file.txt','hello world')
使用上述方法,在Google Drive文件夹中创建名为“file.txt”的文件。但我必须上传一个现有的zip文件
我正在使用下面的代码在google drive中上传zip文件
Storage::disk('google')->put('RandomFileName.zip',Storage_path('app/backup.zip')代码>
Zip文件已创建,但有时会损坏大小为50字节的文件 根据的文档,您应该使用copy
或move
方法,而不是put
因此,您的代码应该类似于:
Storage::disk('google')->move(storage_path('app/backup.zip'), 'RandomFileName.zip');
我已经解决了这个问题
Storage::disk('google')->put('FileName.zip', file_get_contents("fileLocation"));
以前我没有包含文件\u get\u contents()这就是为什么它没有包含zip文件的内容。我想将文件上载到google drive你有什么办法吗?