How to solve the error?
this is my htm code (button upload)
{{ form_open({files: true, request: 'onFileUpload'}) }}
<!--File Input-->
<input type="file" name="file-upload" required="required">
<!--File Input-->
<!--Submit/Upload Button-->
<button type="submit">Upload</button>
{{ form_close() }}
this is the component php code
public function onFileUpload()
{
$file = new System\Models\File;
$file->data = Input::file('file-upload');
$file->save();
// Attach the uploaded file to your model
$model->file()->add($file);
// The above line assumes you have proper attachOne or attachMany relationships defined on your model
$model->file_path = url('/') . $model->file->getPath();
$model->save();
return Redirect::back();
}
is this the proper attachMany relationship?
public $attachMany = [
'files' => 'System\Models\File',
];
}
I'm not very sure about the code cause I'm new to October cms Can anyone show some examples? How to create a drag and drop file uploader component?