Hey,
Currently i'm having an use case where candidates can submit a form for a scholarship.
in this form the candidate will upload 2 documents.
I have this candidate collection with this field:
{
name: 'identification_document',
type: 'relationship',
relationTo: 'documents',
label: {
pt: 'Documento de identificação',
en: 'Identification document',
},
And the documents collection is like:
import { CollectionConfig } from 'payload'
import { isAdmin } from '../access/AccessManagement'
export const Documents: CollectionConfig = {
slug: 'documents',
...
admin: {
useAsTitle: 'name',
group: { pt: 'Interno', en: 'Internal' },
hidden: ({ user }) => user?.role !== 'admin',
},
upload: {
adminThumbnail: 'small',
staticDir: 'documents',
mimeTypes: ['application/pdf'],
},
fields: [
{
name: 'name',
type: 'text',
},
...
now, the thing is, i'd like that when i create a candidate, to organize the path like documents/${scholarshipcode}/{candidateemail}/ and then the file name.
is there a way to achieve this?
i tried to use the BeforeOperation hook to set the file name with slashes, but the slashes are ignored on my s3 bucket.
thanks in advance