Feature #62091
openAdd conflict handling to FAL create methods
0%
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()).
Updated by Gerrit Code Review over 6 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56815
Updated by Gerrit Code Review over 6 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56815
Updated by Anja Leichsenring about 6 years ago
- Status changed from Under Review to New