0

After uploading a document successfully like this:

$documentUploaded = $company->addMedia($file)->toMediaCollection();

When I try to fetch the document using storage:

Storage::get($documentUploaded->getPath());

I get the following error:

League\Flysystem\FileNotFoundException(code: 0): File not found at path: C:/wamp/www/my-app/storage/app/public/69/THIS-WILL-BE-ENCRYPTED.docx at C:\wamp\www\my-app\vendor\league\flysystem\src\Filesystem.php:388) [stacktrace]

When I try to dump the file path:

dd($documentUploaded->getPath());

I get this:

C:\wamp\www\my-app\storage\app\public/69/THIS-WILL-BE-ENCRYPTED.docx

When I check in both storage and public directories I can see the file there.

I already created a symlink between the public and storage directories with php artisan storage:link so I don't know what's going on here?

user3574492
  • 6,225
  • 9
  • 52
  • 105

1 Answers1

0

The path should be relative to the 'project_name/storage/app' folder. So you have to do this

Storage::get('public/69/THIS-WILL-BE-ENCRYPTED.docx');
Sakib Abrar
  • 161
  • 10