1

hi guys im pretty new in laravel 4.2 i have a project that stores file in the server and what i did based from the opinion of other people, when the user saves a file it goes to app/storage/uploads my problem is when i know the url to the file, it still have access to the file. for example it is a pdf file, it opens in the browser or if it is doc, xls, xlsx etc it triggers a download what i'm tying to do is when the user tries to access that url, it would go to a certain view informing them that the folder is restricted so far i have this on my routes

Route::get(storage_path().'uploads/{all?}' , 'sample@restrict');

then in my controller

public function restrict()
{
    dd("WHOOOPS!"); //for trial purposes
}

any ideas what im doing wrong? thanks in advance

BourneShady
  • 955
  • 2
  • 17
  • 36

1 Answers1

3

With normal configuration web server has access only to a public directory.

If you set public directory as root for a virtual host, noone will be able to access app or storage directories which are outside public.

Community
  • 1
  • 1
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279