Hi
I have a question, I’m building a press release section with a data object in 3.1. I want to upload pdf files with the function that if the file already exist that he not overwrite it but just add a number to it.
I see there is a setting “setReplaceFile” that would do that, but whatever I do it does not seem to work.
Any tips on how to get this to work?
This is what I have so far
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', DateField::create('Date','Date of Press Release')
->setConfig('showcalendar', true));
$fields->addFieldToTab('Root.Main', TextField::create('Headline','Headline'));
$fields->addFieldToTab('Root.Main', HtmlEditorField::create('Excerpt')->setDescription('Add something like the first paragraph of the press release'));
$fields->addFieldToTab('Root.Main', $PressReleases = UploadField::create('PressRelease','PressRelease file (PDF only)'));
$PressReleases
->setFolderName('ShowPro/press/PressRelease')
->getValidator()->setAllowedExtensions(array('pdf'));
$PressReleases->getUpload()->setReplaceFile(false);
return $fields;
}