我正在尝试使用@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
发布评论