如何在Uppy中重命名文件? javascript

问题描述

我正在尝试重命名uppy.js中的文件。根据文档,有2个功能可以提供此功能。我定义了这两个函数,但是它们对文件名没有影响,也不会引发任何错误。如何使用这些功能来重命名文件?

onBeforeFileAdded: (currentFile,files) => {
  const modifiedFile = {
    ...currentFile,name: currentFile.name + '__' + Date.now()
  }
  return modifiedFile
}

onBeforeUpload: (files) => {
  if (Object.keys(files).length < 2) {
    // log to console
    uppy.log(`Aborting upload because only ${Object.keys(files).length} files were selected`)
    // show error message to the user
    uppy.info(`You have to select at least 2 files`,'error',500)
    return false
  }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)