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

Bvanhaastrecht's avatar

Mail attachment troubles when using local disk

Hello,

I have not defined any storage disks, so its set to the default 'local' which is ../storage/app.

I'm storing my files as: $file->storeAs('dir1/dir2', $uuid, 'local');

This saves my files as ../storage/app/dir1/dir2/<uuid string>

Attach a file to an email:

$this->attachFromStorageDisk('local', 'dir1/dir2', $uuid, [
		 'as' => $originalName
]);

When the recipient receives this email the attachment is there but it has 0 bytes. The attachFromStorageDisk() doesn't check if the file is there and no matter what folder I set, I always get a 0 bytes attachment. So I think the attachFromStorageDisk() isn't able to find my file and apparently it does not take the exact same path as the storeAs().

When I use attach with full path it works just fine.

Hope anyone can help me with this.

Regards, Bastiaan

0 likes
0 replies

Please or to participate in this conversation.