Issue Feature New Orphaned

#62091Add conflict handling to FAL create methods

Simon Praetorius 10/07/14, 22:18 updated 10/02/18, 13:09

Description

When adding files to a FAL file storage with addFile() the $conflictMode parameter allows to handle file name conflicts easily (cancel, replace or renameNewFile). It would be nice if that conflict handling could be provided for create methods as well. In my case I want to add files from remote servers to a file storage, but with their original file name:

$url = 'http://example.com/file.ext';
$filename = basename($url);
$content = GeneralUtility::getUrl($url);

$storage = $storageRepository->findByUid(1);
$folder = $storage->getFolder('1:myFolder');

$folder->createFile($filename)->setContents($content);

Currently there seems to be no proper way to rename a new name automatically if another file with the same name already exists. With the proposed change the last line could look like this:

$folder->createFile($filename, 'renameNewFile')->setContents($content);

I think that this would be helpful for folders as well (createFolder()).

Reviews 1

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". The changes above were merged or abandoned: read them before you start. How to create a patch

Commit message
[FEATURE] Add conflict handling to FAL create methods Resolves: #62091 Releases: main