Skip to content

Commit 96502fc

Browse files

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,27 @@
1919
* Fix Windows compatibility.
2020
* Fix file cannot be uploaded to "File Mode".
2121
* Config file is also refactored, see [config document](https://unisharp.github.io/laravel-filemanager/config).
22-
22+
23+
## Security
24+
25+
It is important to note that if you use your own routes **you must protect your routes to Laravel-Filemanager in order to prevent unauthorized uploads to your server**. Fortunately, Laravel makes this very easy.
26+
27+
If, for example, you want to ensure that only logged in users have the ability to access the Laravel-Filemanager, simply wrap the routes in a group, perhaps like this:
28+
29+
```php
30+
Route::group(array('before' => 'auth'), function ()
31+
{
32+
Route::get('/laravel-filemanager', '\Tsawler\Laravelfilemanager\controllers\LfmController@show');
33+
Route::post('/laravel-filemanager/upload', '\Tsawler\Laravelfilemanager\controllers\LfmController@upload');
34+
// list all lfm routes here...
35+
});
36+
```
37+
38+
This approach ensures that only authenticated users have access to the Laravel-Filemanager. If you are using Middleware or some other approach to enforce security, modify as needed.
39+
40+
**If you use the laravel-filemanager default route, make sure the `auth` middleware (set in config/lfm.php) is enabled and functional**.
41+
42+
2343
## Credits
2444
Special thanks to
2545

0 commit comments

Comments
 (0)