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

el_dorito's avatar

Attachable works on local dev enviroment but not on forge

Hello everyone

I'm trying to send an e-mail with an attachment. The files are uploaded trough a form and stored onto a local disk. When run the code om my local dev machine (Windows 10) everything works well. When I deploy the code to my server trough Forge I get file not found errors. I've created the links to the directories on the Forge server as well.

//storage configuration
'attachments' => [
            'driver' => 'local',
            'root' => storage_path('app/attachments'),
            'url' => env('APP_URL').'/attachments',
            'visibility' => 'public',
        ],

//code to store the file on the disk. I store the both the random and original filename in a model called EmailAttachment
$attachment->store('attachments');

//the toMailAttachment() code I use 
 public function toMailAttachment()
    {
        return Attachment::fromPath($this->filename)
            ->as($this->original_filename);
    }

Any tips and advice is most welcome.

Best regards Geert

0 likes
0 replies

Please or to participate in this conversation.