I want a user to upload a PDF file to his request. On the backend, I can manage to save the file on server, but I'm looking for a way to save it in the Entry just as if I was doing it manually on the admin panel but don't know how. So far I tried different things but I'm not sure what goes in the "cadFile" field as a handle to the actual file. Any help would be appreciated.
if($_FILES){
$myFile = UploadedFile::getInstanceByName('cadFile');
$success = $myFile->saveAs('assets/order/' . $myFile->baseName . '.' . $myFile->extension);
if($success) {
$model->setFieldValue('cadFile', [$myFile->baseName . '.' . $myFile->extension]);
$success = Craft::$app->elements->saveElement($model, false);