douba9425 2017-03-28 14:27 采纳率: 100%
浏览 34

TYPO3 Powermail - 上传表单 - 如果已经存在同名文件,则必须覆盖该文件

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.

  • 写回答

1条回答 默认 最新

  • duanhuren5581 2017-03-28 15:21
    关注

    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)

    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法