I am using powermail extension to create a form for upload of several file types. This form is located in a login area. For every logged in user there is a folder with its name created where the uploaded files are stored.
# get personal storage folder for logged in user
lib.userfolder = TEXT
lib.userfolder {
data = TSFE:fe_user|user|username
wrap = fileadmin/user_upload/|/
required = 1
}
# Powermail file upload settings
plugin.tx_powermail.settings.setup.misc.file {
folder = fileadmin/user_upload/
size = {$plugin.tx_powermail.settings.misc.uploadSize}
extension = {$plugin.tx_powermail.settings.misc.uploadFileExtensions}
randomizeFileName = {$plugin.tx_powermail.settings.misc.randomizeFileName}
}
this works fine so far. The problem is that if a file with a name "example.pdf" already exists and another file named "example.pdf" is uploaded the file is not overwritten. Instead the uploaded file "example.pdf" will be renamed to "example_01.pdf". A good behaviour in general but not fitting my needs. I need an approach to handle this problem would be nice to get some hints here.
To keep the old files is default behaviour in powermail. Overwrite existing files is not implemented.
Possibilities: - Building an own uploader in a finisher class (see https://docs.typo3.org/typo3cms/extensions/powermail/ForDevelopers/AddFinisherClasses/Index.html) - Overwriting the existing uploader \In2code\Powermail\Domain\Service\UploadService with e.g. a XClass - Clearing the uploaded files every X hours (probably no option)