Kendo Upload Component Issue

0 Answers 133 Views
Upload
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Tejas asked on 24 May 2023, 07:53 AM

i am creating a upload component to upload file and images to DB via link.
following is the code snippet for the same
i am able to upload the files and images
but when editing the data, onAdd function is cancelling the upload


if i remove setSignImgPathAzure then component works fine but i need to set the state to empty string for other dependency

i tried with using callbacks and basic debugging
not able to solve the error

  const onChangeHandler = (event: UploadOnAddEvent) => {
      fieldRenderProps.onChange({ value: event.newState });
      setSignImgPathAzure("");

    };

 

<Upload
            className="k-mt-5"
            batch={false}
            multiple={true}
            defaultFiles={[]}
            withCredentials={false}
            saveUrl={LOGO_UPLOAD_SAVE}
            onAdd={onChangeHandler}
            onRemove={onRemoveHandler}
            onStatusChange={getImgPath}
            restrictions={{
              allowedExtensions: FIELD_ALLOWED_IMAGE_TYPES,
              maxFileSize: 2000000,
            }}

          />

 

 

 

 

 

Wissam
Telerik team
commented on 26 May 2023, 06:58 AM

Hi, Tejas,

Thank you for the provided code sample.

I understand that this issue is caused when adding new files. Is this what you mean by editing the data? If not, could you please provide me with more information about the data editing?

Moreover, I tried rendering the `Upload` as a Field component and updating a state variable inside it, but unfortunately, I could not reproduce the faced issue. Therefore, could you please send me a runnable example where the issue is reproduced? You can use my test demo as a base:

No answers yet. Maybe you can help?

Tags
Upload
Asked by
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or