PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, January 24, 2022

[FIXED] Laravel filesystem, How to set public file only can view by after login

 January 24, 2022     laravel, laravel-5, php     No comments   

Issue

Laravel 5.7 PHP 7.2 DB mysql

already see https://laravel.com/docs/5.7/filesystem I am using the Local Driver.

after some process, I have set a image to public file. e.g. https://127.0.0.1/storage/myViewFile/0120020301-3.png

I want to set only can view dir "myView File" after login.

How can I do it? thank you.


Solution

Route::get('/storage/files/{file}', 'FilesController@show')->middleware('auth');

and in the show method display the image.



Answered By - Andy Song
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing