如何解决Laravel Excel :: Im使用Google云存储导入突然停止工作,并给出错误:mkdir:没有这样的文件或目录
一段时间以来,我一直在使用Laravel导入上传到Google云存储的文件。 在不更改任何代码的情况下,以下调用突然停止工作。
Excel::import($importer,$document->path,env('GOOGLE_STORAGE_DISK','local'),$fileType);
从import方法跟踪的返回错误如下。
"message": "mkdir(): No such file or directory","exception": "ErrorException","file": "/workspace/vendor/maatwebsite/excel/src/Files/TemporaryFileFactory.php","line": 52,"trace": [
{
"function": "handleError","class": "Illuminate\\Foundation\\Bootstrap\\HandleExceptions","type": "->"
},{
"file": "/workspace/vendor/maatwebsite/excel/src/Files/TemporaryFileFactory.php","function": "mkdir"
},{
"file": "/workspace/vendor/maatwebsite/excel/src/Reader.php","line": 398,"function": "makeLocal","class": "Maatwebsite\\Excel\\Files\\TemporaryFileFactory","line": 99,"function": "getReader","class": "Maatwebsite\\Excel\\Reader",{
"file": "/workspace/vendor/maatwebsite/excel/src/Excel.php","line": 146,"function": "read",{
"file": "/workspace/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php","line": 261,"function": "import","class": "Maatwebsite\\Excel\\Excel",{
"file": "/workspace/app/Http/Controllers/ImportController.php","line": 175,"function": "__callStatic","class": "Illuminate\\Support\\Facades\\Facade","type": "::"
},
这是在TemporaryFileFactory.php中引发错误的行
if (!file_exists($this->temporaryPath) && !mkdir($concurrentDirectory = $this->temporaryPath) && !is_dir($concurrentDirectory)) {
我根本不知道如何开始解决这个问题。由于我没有进行任何代码更改,因此我只能假定是某些库的新版本。但是我已经尝试在composer.json
中对旧库版本进行硬编码。"maatwebsite/excel": "3.1.19",
并运行composer install似乎没有什么区别。任何在解决该问题的方向上的领导都将不胜感激。
解决方法
我决定改用'/ tmp',
为此,我需要发布并更改config / excel.php
php artisan vendor:publish –provider="Maatwebsite\Excel\ExcelServiceProvider"
编辑config / excel.php
'local_path' => '/tmp',
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。