1

I am currently working at October CMS plugin development, I have a problem with file upload. I put the fileupload type to file_src. When I go to to resource it shows an error like this :

enter image description here

model/resource
    fields:
        name:
            label: Name
            type: text
            required: true
        file_src:
            label: Upload
            type: fileupload
        grade_id:
            label: Grade
            type: dropdown
            emptyOption: Select
            showSearch: true
        subject_id:
            label: Subject
            type: dropdown
            emptyOption: Select
            showSearch: true
        type_id:
            label: Type
            type: dropdown
            emptyOption: Select
            showSearch: true

How can I fix this error?

ɢʀᴜɴᴛ
  • 32,025
  • 15
  • 116
  • 110
Ansaf Ans
  • 91
  • 3
  • 12

2 Answers2

5

I fixed it! We must use $attachOne or $attachMany relation on model

I added following code in Resource.php in models

public $attachOne = [
    'file_src' => 'System\Models\File'
];

thats it its working now!

Ansaf Ans
  • 91
  • 3
  • 12
1

Define the current module the selected control is a file. Mean your current selected control is as a file and you does not define in your module that time the backend has confused.

Solution:

public $attachOne = [
        'profile_pic' => \System\Models\File::class
    ];
Kaushik shrimali
  • 1,178
  • 8
  • 15