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 add re-captcha v3 on all Elementor forms using coding?

 Add re-captcha v3 on all Elementor forms using coding add_action('wp_footer',function(){     ?> <script src="https://www...