Files field not saving
# ❓questions
t
Hi, using Twill3 I added a files form field as directive by following the steps here: https://twillcms.com/docs/form-fields/files.html
Copy code
@formField('files', [
   'name' => 'pdf_file',
   'label' => 'File',
   'itemLabel' => 'PDF File'
])
I added the
HasFiles
and
HandleFiles
traits to the model and repo. The form shows up and I am able to upload the file but it won't "stick" when I press save. Any tips what else I should do?
i
Hi @Tobi Wan it is not clear enough in the docs I think but it's there, you need to add this to your model:
Copy code
public $filesParams = ['pdf_file'];
all your files field names should be in this array for them to save properly
if the files field is in a block, the name should be in
twill.block_editor.files
t
ah, OK. Yeah, that's not clear in the docs but makes sense now. Thanks!