0
I have a routine in the project where I attach documents but I can not in any way that Storage find the same.
This is my download method:
public function download($id)
{
$anexo = PendenciaAnexo::where("id", "=", $id)->get()->first();
Storage::download(PathController::pathPendAnexos($anexo->pend_anexo_file_path));
}
This is another method I use to set a path for when I am in development and when I am with the project in production on the network:
public static function pathPendAnexos($file_path)
{
if(ConfigController::modeOfDevelopment() == "production"){
return '/storage/pend_anexos/'.$file_path.'';
}else{
return '/storage/public/pend_anexos/'.$file_path.'';
}
}
Files in my project:
** absolute path within the project
C: laragon www Logisticsupportx public Storage public pend_attachments
** in the Storage folder:
C: laragon www Logisticsupportx Storage app public public pend_attachments
I’ve tried everything with several possible and absolute paths but nothing works, always this same mistake:
File not found at path: Storage/public/pend_attachments/PEND_80_ANEXO_4.pdf
But the files are there!!
Is there a folder called Storage inside the public folder? If you are in separate directories you can create a symbolic link to the public folder pointing to Storage
– Paulo Martins
php Artisan Storage:link > vide doc https://laravel.com/docs/8.x/filesystem#the-public-disk
– Marcos Xavier
Actually this Storage is the symbolic link, but I do not understand why not find if the product registration I use something similar with the same path but with different folders!
– Ulisses Gimenes
This is the product list: Return '/Storage/public/products/'. $file_path.'';
– Ulisses Gimenes