Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

snake_py's avatar

Vapor load files from public folder

Hello, I am thinking I am trying to do something very simple and load a file from my public folder. While this works locally, I cannot load the file in our deployed version. We are using laravel Vapor UI, so our App is inside lambda.

So I followed several solution approaches:

  • tried to load from public folder
  • tried to load from storage folder
  • tried to load from ressource folder
  • tried to load from asset store

I am a bit at the end. I do not want to store the file in a S3. How can I load the pdf file from the local disk within lambda?

This is the current solution I am following, which seems very bad to me.

            $file = file_get_contents($_ENV['ASSET_URL'] . '/pdf/' . $this->attachmentPdf);
            Storage::disk('s3')->put('tmp/' . $this->attachmentPdf, $file);
            $this->attachFromStorageDisk(
                's3',
                'tmp/' . $this->attachmentPdf,
                $this->attachmentPdf,
                [
                    'as' => $this->attachmentPdf,
                    'mime' => 'application/pdf',
                ]
            );
0 likes
1 reply

Please or to participate in this conversation.