I am uploading files to a user’s account, using a form on the front end. All is working fine, and the file is appearing in the user’s directory, but I now need to create the .txt file to go with the file itself. I am using the
File::factory, but am getting an error when I upload the file. This is my code as it stands:
$file = File::factory([ 'parent' => kirby()->user()->contentFileDirectory(), 'filename' => $filename, 'template' => 'selfie-image', ]);
And I am getting the error:
Argument 1 passed to Kirby\Cms\File::setParent() must be an instance of Kirby\Cms\Model or null, string given
I think this is because my parent setting is incorrect, but I am not sure what to change it to. If anyone has any thoughts that would be great.