27 February 2023

How to upload file in public folder by storage function in Laravel 8?

upload file in public folder by storage function in Laravel 8



//filesystems.php   


   'disks' => [

        'uploads' => [

             'driver' => 'local',

             'root' => public_path() .'/upload',

             'visibility' => 'public',

        ]

    ]

//My-project(Laravel)\public\upload\images\blogs


use Validator;

use file;

use Illuminate\Support\Facades\Storage;



$request->validate([

'featured_image' => 'required|max:2048',

]);


$name = $request->file('featured_image')->getClientOriginalName();

$file_path = $request->file('featured_image')->storeAs('images/blogs', $name, 'uploads');

No comments:

Post a Comment

How to create youtube videos slider with play and pause option in wordpress?

Create youtube videos slider with play and pause option in wordpress youtube videos slider Use this shortcode:- [punjab_today] function my_...