Need server-side Upload script used by Spreadsheet Server Import example

1 Answer 61 Views
Spreadsheet Upload
Angelo
Top achievements
Rank 1
Angelo asked on 01 Sep 2022, 05:47 PM

Using this example: https://demos.telerik.com/kendo-ui/spreadsheet/server-side-import-export

I can't find the server-side script being run by this config: saveUrl: "/kendo-ui/spreadsheet/upload"

Where can I find this server-side script?

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 06 Sep 2022, 07:03 AM

Hi Angelo,

I replied earlier in the support thread regarding the same issue. However, as it could be helpful to the other users in the Forum I will paste my reply below as well.

The endpoints of the Kendo UI for jQuery Spreadsheet Server Import/Export Demo are identical to the Server_Side_Import_ExportController.cs of the UI for the ASP.NET Core Spreadsheet demo. In the linked demo you can click on the 'View source' - > 'Server_Side_Import_ExportController.cs' and examine the implementation. 

For convenience, below is the code for the Upload endpoint:

[HttpPost]
        public ActionResult Upload(IFormFile file)
        {

            var workbook = Workbook.Load(file.OpenReadStream(), Path.GetExtension(file.FileName));
            return Content(workbook.ToJson(), Telerik.Web.Spreadsheet.MimeTypes.JSON);           
        }

And in case the backend of your app is on Asp.Net MVC you can take a look at the UI for ASP.NET MVC Demos endpoint:

[HttpPost]
        public ActionResult Upload(HttpPostedFileBase file)
        {
            var workbook = Workbook.Load(file.InputStream, Path.GetExtension(file.FileName));
            return Content(workbook.ToJson(), Telerik.Web.Spreadsheet.MimeTypes.JSON);
        }

 

I hope this helps.

Regards,
Neli
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
Spreadsheet Upload
Asked by
Angelo
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or