Example of File upload in ammannbe/RecipeManager

File composer.json (link to Github)
{
    //
    "require": {
        "php": "^7.4|^8.0",
        //
        "spatie/laravel-medialibrary": "^9.4"
    },
    //
}
File app/Models/Recipes/Recipe.php (link to Github)
use Spatie\MediaLibrary\HasMedia;
use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\InteractsWithMedia;

class Recipe extends Model implements HasMedia
{
    use InteractsWithMedia;
    //
    public function registerMediaConversions(Media $media = null): void
    {
        $this->addMediaConversion('thumbnail')
            ->width(200)
            ->height(200)
            ->sharpen(10);

        $this->addMediaConversion('webp')
            ->format(Manipulations::FORMAT_WEBP);
    }
    //
}
File app/Http/Controllers/Recipes/RecipePhotoController.php (link to Github)
use App\Http\Controllers\Controller;
use App\Models\Recipes\Recipe;
use App\Http\Requests\Recipes\RecipePhoto\Store;
use Spatie\MediaLibrary\MediaCollections\FileAdder;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

class RecipePhotoController extends Controller
{
    public function store(Store $request, Recipe $recipe)
    {
        $this->authorize('update', $recipe);
        $recipe->addAllMediaFromRequest()->each(function (FileAdder $fileAdder) {
            $fileAdder->toMediaCollection('recipe_photos');
        });
    }
    //
}

Additional resources on File upload: