I am using Laravel 5.7, I can upload files to my system with form that I craeted. I am having hard time making them accesible to my users of the system. How do I do that? I keep getting 404 errors.
My filesystem driver
'default' => env('FILESYSTEM_DRIVER', 'public'),
this saves all files to "storage/app/public",
foreach ($request->attachments as $attachment) {
$originalname = $attachment->getClientOriginalName();
$ext = $attachment->getClientOriginalExtension();
$formattedname = "doc$doc->id-$i.$ext";
$filepath = $attachment->storeAs("pdocs/customers/$customer/projects/$projectid/tr", $formattedname);
ReviewAttachment::create([
'customer_id' => $customer,
'project_id' => $projectid,
'user_id' => $user,
'filepath' => $filepath,
'filename' => $originalname,
]);
$i++;
}
then show the link from that saved attachmed as below;
<a href="{{Storage::disk('public')->url('$attachment->filepath')}}"> View </a>