I would like to have any via textarea or files field uploaded file of a page being uploaded to a specific subfolder/subdirectory of the current page specified in the blueprint. Is this possible?
I found this information but I don’t see a context between files property and uploads property of the textfield and what I would like to achieve:
By default all files will be uploaded to the current page and without a predefined template. With the additional options you can fetch files from anywhere and upload them to specific pages. You can also control which file template should be assigned by default:
I fiddled around with these two options but except a non-existing template applied to my uploads, I see no difference. How can I achieve a subfolder for my uploads on a single page?
This files field is used to upload files which should be stored in the subfolder (page) test. I created the test folder manually and created a file called uploaded_files.de.txt which references this uploaded_files.yml blueprint:
title: Uploaded Files
preset: files
On an upload via this files field, I get this error:
Call to a member function createFile() on null
No clue if I’m on the right way or completely wrong. Right now, I’m not sure what specifies the file location/destination.
What is the purpose of the uploaded_files.de.txt file`
textarea:
uploads:
# find the upload folder, page must exist, otherwise it probably falls back to current page or throws an error
parent: page.children.find('test')
# assign the template
template: textarea-upload
The template doesn’t have to exist for this to work, I think.
However, you would have to use a hook that automatically creates the subpage on page creation for this setup to work.
Hi @texnixe! First of all, thank you for your 24/7 epic support here!
Can you explain to me why the find part matters here? I tried it before with
parent: page.children.test
because I suspected that I can provide the ID without a find because I’m aware that it exists and should exist always (given I keep care of it via some hook, like you mentioned). Is there a meaningful context behind the notation of the query language I did provide or would this be always an invalid query?