Kendo React上传,如何使用其相应事件执行自定义上传/删除

发布于 2025-02-10 01:38:19 字数 1153 浏览 2 评论 0 原文

我正在尝试使用@progress/kendo-react-upload组件上传的

上传应在db morovere上载文件中插入一些元数据,因此我不会使用 saveurl remove urll ,但在添加e删除事件期间调用服务器

upload 组件具有以下属性:

<Upload
        autoUpload={false}
        onRemove={onRemove}
        onStatusChange={onStatusChange}
        defaultFiles={files}
      />

autOupload = false ,因为选择时不应自动上载文件,但是在

defaultfiles 按下上传按钮时,我想在列表中显示的文件(允许用户删除这些文件)最终,从服务器中,这些文件被正确识别到事件 onremove )中,

const onRemove = (event: any) => {
    const fileToRemove = event.affectedFiles;
    //...call the server to remove (removing the file and its metadata in the db)
};

方式中正确列出了新的选定文件:

const onStatusChange = (event: UploadOnStatusChangeEvent) => {
     const readyToUpload = event.affectedFiles.filter(
       (item: UploadFileInfo)   => item.status == UploadFileStatus.Uploading
     );

     //...call the server to upload the file and add some metadata into a databae
  };

在以下 当添加或从组件中添加或删除这些文件并管理相应事件中的上传时,代码>自动调用

i'm trying to implement a custom upload using the @progress/kendo-react-upload component

the upload should insert some metadata in the db morovere uploading the file, so i wouldn't use the saveUrl and removeUrl but to call the server during the adding e removing events

the Upload component has these properties:

<Upload
        autoUpload={false}
        onRemove={onRemove}
        onStatusChange={onStatusChange}
        defaultFiles={files}
      />

autoupload=false, because the file shouldn't be uploaded automatically when selected but when the upload button is pressed

in defaultFiles there are previously uploaded files that i want to show in the list (to permit the user to deleted these files from the server eventually, these file are correctly identified into the event onRemove)

const onRemove = (event: any) => {
    const fileToRemove = event.affectedFiles;
    //...call the server to remove (removing the file and its metadata in the db)
};

new selected files are correctly listed in the:

const onStatusChange = (event: UploadOnStatusChangeEvent) => {
     const readyToUpload = event.affectedFiles.filter(
       (item: UploadFileInfo)   => item.status == UploadFileStatus.Uploading
     );

     //...call the server to upload the file and add some metadata into a databae
  };

how to prevent that saveUrl and removeUrl are automatically invoked when thes files are added or removed from the component and to manage the upload in the corresponding events

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文