Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel - access file from storage path - alternative to symlink

Route::get('storage/{filename}', function ($filename)
{
    $path = storage_path('public/' . $filename);

    if (!File::exists($path)) {
        abort(404);
    }

    $file = File::get($path);
    $type = File::mimeType($path);

    $response = Response::make($file, 200);
    $response->header("Content-Type", $type);

    return $response;
});
Comment

PREVIOUS NEXT
Code Example
Php :: Export database to sql dump in php 
Php :: asas 
Php :: Users/admin/Library/Caches/composer/files/laravel/laravel/1548f0533da115f0828fab4ef0c3923cd57879b6.zip): Failed to open stream: Permission denied 
Php :: php get non unique values from array 
Php :: php glob multiple file with different formats in directory 
Php :: php remove utf non breaking space 
Php :: validate phone number with dial code laravel 8 
Php :: how to set default php version in ubuntu 
Php :: if cat 1 then send email woocommerce functions 
Php :: function placing bet using php 
Php :: radio button in php form 
Php :: Include Or Require Multiple Files On 1 Line 
Php :: how to include page specific css in xphp smart header 
Php :: snippet php symfony route 
Php :: php blade first child @foreach 
Php :: php regex markdown link 
Php :: php?gs=3 
Php :: direct without public laravel 
Php :: php code for english translation optin 
Php :: Find template serving current page 
Php :: code on editing an image in database in php 
Php :: php run python script with arguments json 
Php :: php file structure 
Php :: Final class constants - PHP 8.1 
Php :: php store html in varible 
Php :: laravel compile blade 
Php :: Cant find AddHandler of PHP inside Apache configuration files 
Php :: Laravel model - CRUD only with records where one column = certain value 
Php :: show file in folders phpstorm 
Php :: dispaly image on front end of custom taxonomy 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =