php - How to authenticate users and securely serve videos for them to watch? -
i trying prevent unauthorize users being able view video on company internal website using laravel 4.2.
the videos stored outside document root. therefore, need way serve videos users.
i have route handles request follows:
route::get('video/{name}', function($name){ $type = explode('.', $name)[1]; header("content-type: video/$type"); $file = "c:\\xampp5-4\\intranet\public\\$name"; readfile($file);//i tried return response::download($pathtofile); video download, not play die();//$this simple example of many things i've tried })->before('auth');
it works in pure php, reason not working in laravel.
Comments
Post a Comment