I am trying to prevent users not registered on the network from downloading the contents that I have uploaded to the shared directory. I am currently working on Laravel 5.2. So now, what I did, I just create a URL that checks the file name and folder name and uploads the files. Thus, I hide the folder of the parent folders from users. But this is not a good practice, because if someone finds the file URL, he can access it without logging in.
This is my loading script:
public function getFile(Request $request)
{
*************
*************
$folderFilePath = public_path('my file directory');
return response()->download($folderFilePath, $filename, []);
}
So, is there a way that can limit downloading from a specific directory to unregistered users in laravel? Thank you very much in advance.