Catalin Farcas
Catalin Farcas

Reputation: 655

Additional button in Upload File Form using SilverStripe

I am using Silverstripe 3.1. If i try to upload a file(image) using the File Uploader from CMS and that file already exists, i get the following: enter image description here

The thing i want is to add another button to "Use That File" instead of overwriting it. I think makes more sense and i tried to search deep in the File class but i could not find where shoud i start.

Upvotes: 1

Views: 97

Answers (1)

wmk
wmk

Reputation: 4626

There is a config setting to tell UploadField NOT to overwrite the file but instead suffix it to avoid name conflicts:

$uploadField->getUpload()->setReplaceFile(false);

If you want it set globally, you can use config system like:

Upload:
  replaceFile: false

which is the standard setting.

Upvotes: 1

Related Questions