Answers for "upload files in public folder laravel"

PHP
3

laravel upload image to public folder

<?php

if($request->hasFile('image')){
    $image = $request->file('image');
    $image_name = $image->getClientOriginalName();
    $image->move(public_path('/images'),$image_name);

    $image_path = "/images/" . $image_name;
}

?>
Posted by: Guest on September-05-2021
2

how to store file in public folder laravel

You can create a new storage disc in config/filesystems.php
'public_uploads' => [
    'driver' => 'local',
    'root'   => public_path() . '/uploads',
],

And store files like this:

if(!Storage::disk('public_uploads')->put($path, $file_content)) {
    return false;
}
Posted by: Guest on December-12-2021

Code answers related to "upload files in public folder laravel"

Browse Popular Code Answers by Language