[Laravel] - How to protect upload folder from web access

Standard

1. Create .htaccess file
2. Create mod rewrite rule
    RewriteRule ^upload/(\w+)\.([a-z]{3,4})$ file.php?name=$1&type=$2 [L]
3. Create file.php
if(Auth::user()->role == 'admin') {
    header("Content-type: image/" + $_SESSION['type']);
    readfile("/path/to/image/" + $_SESSION['name'] + '.' + $_SESSION['type']);
else {
    header("Location: http://mysite.com/login");
}

Ref : http://stackoverflow.com/questions/15474742/laravel-protect-image-folder-from-web-access