【发布时间】:2020-06-01 11:44:18
【问题描述】:
我在 Elasticbeanstalk 上部署了一个 laravel 应用程序,我正在开发一个功能,我需要从 s3 存储桶中获取一个 zip 文件,将其存储到本地存储中,以便能够使用 laravel-zip 删除一个来自该 zip 的 pdf 文件。 该代码在本地运行,但在生产测试后我收到“没有此类文件错误”:
// get the file from s3 and store it into local storage
$contents = Storage::disk('s3')->get($file_name);
$zip_local_name = 'my_file.zip';
Storage::disk('local')->put($zip_local_name, $contents);
// use laravel-zip to remove the unwanted pdf file from the result
$manager = new ZipManager();
$file_path = storage_path('app').'\\'.$zip_local_name; // register existing zips
$manager->addZip(Zip::open($file_path));
$zip = $manager->getZip(0);
$zip->delete($data["Iso_Bus"]["field_name"].'.pdf');
$zip->close();
我确保该文件存在于 s3 上,所以我认为我的主要问题是该文件未存储在本地存储中。 任何帮助表示赞赏
编辑文件系统配置:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => '***',
'secret' => '***',
'region' => '***',
'bucket' => '****',
'url' => '****',
],
],
【问题讨论】:
-
你确定你有写权限,你能添加你的 filesystems.php 配置吗?
-
请给我一个mnt
-
@JasperHelmich 你能解释一下我需要什么写权限吗?
-
@FurqanS.Mahmoud 您在哪一行收到此错误?
-
@HA $manager->addZip(Zip::open($file_path));
标签: laravel amazon-elastic-beanstalk