1

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

pinale
  • 2,060
  • 6
  • 38
  • 72

0 Answers0