This is a migrated thread and some comments may be shown as answers.

Kendo upload with image editor

5 Answers 753 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tomasz
Top achievements
Rank 1
Tomasz asked on 13 Aug 2019, 11:29 AM

Hello,

Is there any possibility to add image editor to kendo upload component?

I was able to create custom listitem that has image editor inside, however I'm not able to make use of it while uploading file to the server. Is there any way to modify UploadFileInfo object and content of the file or at least to send request with custom body? In documentation it is mentioned only beforeUpload event.

In kendoUI for Jquery there is upload event: https://docs.telerik.com/kendo-ui/api/javascript/ui/upload/events/upload

Is there anything like that in Kendo React?

Regards

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 13 Aug 2019, 01:36 PM
Hello, Tomasz,

This can be done when the component is in a controlled state:

https://www.telerik.com/kendo-react-ui/components/upload/modes/#toc-controlled-mode

This allows full control over the files when they are added, uploaded or have any progress when uploading.

Also the "getRawFile" method can be used to obtain the add file during the events:

https://www.telerik.com/kendo-react-ui-develop/components/upload/api/UploadFileInfo/#toc-getrawfile

I hope that this will allow achieving the desired result.

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tomasz
Top achievements
Rank 1
answered on 13 Aug 2019, 02:25 PM

Yes,

this is correct, however onAdd event is triggered when i select the file from file browser. 
As a user I would like to do the following:

1. Fill in form with all relevant data

2. Select and edit image files.

3. Submit form

Unfortunately I couldn't find a way to modify already selected file.

Here is some example:
https://stackblitz.com/edit/react-ts-lwsyc2

0
Stefan
Telerik team
answered on 14 Aug 2019, 06:55 AM
Hello, Tomasz,

Thank you for the example.

I can see that after the editing, the image is stored as image/data base64 string.

In this case I can suggest checking both threads that advise how to upload this type of data in a form:

https://stackoverflow.com/questions/4998908/convert-data-uri-to-file-then-append-to-formdata

https://stackoverflow.com/questions/15675063/how-to-create-an-image-file-on-server-from-dataurl

In this case, as the form data will be uploaded programmatically, there is no need to set the file back to the Upload, as the Upload will only be used to get the files and list them.

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tomasz
Top achievements
Rank 1
answered on 14 Aug 2019, 07:14 AM

Hello Stefan,

thank you for your quick response - will go through that links. Yes, we store images in base64 string as user may want to edit image multiple times before he submits the form.

Beside this we are going to send images as base64 string in request body.
So, seems that in this case Kendo Upload control will create additional boilerplate with not so many benefits and it's better to follow up with custom component based on this: MDN - Working with files

Regards

0
Stefan
Telerik team
answered on 14 Aug 2019, 09:58 AM
Hello, Tomasz,

Thank you for the feedback.

If an a later state you decide to work with the Upload and have additional question I will be happy to assist.

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Tomasz
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Tomasz
Top achievements
Rank 1
Share this question
or