skip to Main Content

when using this: CRUD::field('photos')->type('upload')->withFiles(['path' => 'productphotos']);. it upload the images to the /productphotos directory in the public storage.

When trying to change that to CRUD::field('photos')->type('upload_multiple')->withFiles(['path' => 'productphotos']); on submit I am getting this error: Too few arguments to function BackpackCRUDappLibraryUploadersUploader::getPreviousFiles(), 0 passed in vendor/backpack/crud/src/app/Library/Uploaders/MultipleFiles.php on line 22 and exactly 1 expected

Does anyone know how to fix this error so I can continue? I’ve already tried to only use the settings from the Laravel Backpack docs but still get this error.

Thanks

EDIT:
Version:

### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.0.0
backpack/crud: 6.0.4
backpack/generators: v4.0.0
backpack/permissionmanager: 7.0.0
backpack/theme-coreuiv2: 1.1.3

ProductModel

<?php

namespace AppModels;

use BackpackCRUDappModelsTraitsCrudTrait;
use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;
use IlluminateDatabaseEloquentRelationsBelongsTo;
use IlluminateDatabaseEloquentRelationsHasMany;
use IlluminateDatabaseEloquentRelationsHasOne;

class Product extends Model
{
    use CrudTrait;
    use HasFactory;

    protected $fillable = [
        'category_id',
        'price',
        'weight',
        'quantity',
        'stock_control',
        'notes',
        'age_restricted',
        'sale_item',
        'active',
        'list_index',
        'photos'
    ];

    public function category() : BelongsTo
    {
        return $this->belongsTo(Category::class);
    }
}

2

Answers


  1. Chosen as BEST ANSWER

    It was an bug in Laravel Backpack which is gonna be fixed in version 6.0.6


  2. Can you please share some code (controller, model, routes, etc.) so that we can pinpoint the problem?

    Also, please share the output of this command: php artisan backpack:version.

    Thanks

    Mohammad

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search