How do I upload a file(s) on reactive form submission rather than per upload?

1 Answer 256 Views
Upload
Matt
Top achievements
Rank 1
Iron
Iron
Matt asked on 26 Sep 2022, 02:01 PM

Since if it is saved per upload I need to generate a GUID to then later match the files with the submitted form. It would be easier to somehow only have them all goto the server when the form is submitted.

 

Any code samples for this ? 

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 29 Sep 2022, 07:49 AM

Hi Matt,

By default, the selected files are immediately uploaded and the Upload automatically initiates a POST request to the server. 

An alternative approach is to utilize the FileSelect component. It is especially useful when the developer wants full control over the process of creating the server requests and sent forms. Indeed the FileSelect component does not expose saveUrl option and cannot upload files automatically to the server by design. Instead, it just allows the user to select and list the chosen files. Any server request needs to be done by the developer in the desired event.

In this case, the developer can handle the select event and create the server request to the desired endpoint with the respective files.

The following standalone project demonstrates how the FileSelect could be used with ASP.NET Core API:

https://github.com/telerik/kendo-angular/tree/master/examples-standalone/aspnetcore-upload

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Upload
Asked by
Matt
Top achievements
Rank 1
Iron
Iron
Answers by
Martin
Telerik team
Share this question
or