Hi there,
I have built a front-end form with an upload field. At the moment if i upload a file with the same name it replaces the old one.
Form looks like this:
// ADD FILE FORM
public function AddForm() {
return Form::create(
$this,
"AddForm",
FieldList::create(
TextAreaField::create("Description", "Description")
UploadField::create("MyFile","")
->setAllowedExtensions(array('doc','docx','txt','rtf','xls','xlsx','ppt','pptx','pps','csv','pdf'))
->setAllowedFileCategories('image', 'doc')
->setAllowedMaxFileNumber(1)
->setCanAttachExisting(false)
->setCanPreviewFolder(false)
->addExtraClass("required")
->setFolderName('jobfiles')
),
FieldList::create(
FormAction::create("AddAction","Add File")
->setStyle("primary"
)
)
) ;
}
I have looked at the docs and it seems that i need to add the following to my config.yml file:
---------------------config.yml-----------------------
Upload:
# Globally disables automatic renaming of files and displays a warning before overwriting an existing file
replaceFile: false
---------------------------------------------------------
I tried it, but it does not work (did do a dev build)
Is there another way to force the upload field to not overwrite my file names?
Thanks