michalis's avatar

laravel sail 'file not found at path'

Hey guys, having some weird behavior with sail, but there seems to be no one else with the same issue when I do a google search

I upload a file using a form, and save it to disk like so:

$path = Storage::disk('local')->putFileAs('/public/', $file, $filename);

I have created a symlink too but I don't think that is the issue

I pass my $path to the job I want to run and try to open the file:

$file = fopen($filepath, "r");

or

 $file = Storage::get($path);

but I keep getting File not found at path: var/www/html/storage/app/public/619f3b4b026d5.csv

which yes, that path is wrong, but I am not sure how to have Storage return the correct path

what am I doing wrong?

0 likes
2 replies
Sinnbeck's avatar

Can you show you filesystem.php config file?

1 like
michalis's avatar
michalis
OP
Best Answer
Level 5

@Sinnbeck the filesystem config is the default one, I have not changed it

I managed to make it work

instead of having the Storage disk method return the file path, I just manually recreated it

so instead of

Storage::get($path);

I did

Storage::disk('local')->get("/csv/{$filename}");

Please or to participate in this conversation.