From ce67591f0bd93a90c8e9043c7fad290b788e3793 Mon Sep 17 00:00:00 2001 From: suresh Date: Mon, 22 Apr 2024 16:50:06 +0530 Subject: [PATCH 1/5] 83631: Provide support for catch the returned response body in upload --- .../uploader/EJ2_ASP.NETCORE/async.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md b/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md index 595c61ff56..5fc0ef7252 100644 --- a/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md +++ b/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md @@ -202,6 +202,73 @@ public void Save(IList chunkFile, IList UploadFiles) ``` +### Server-side configuration for save action with returned response + +Here’s how to handle the server-side action for saving the file in server with returned response. + +```c# +[AcceptVerbs("Post")] +public IActionResult Save() +{ + // for JSON Data + try + { + // Process uploaded data + var responseData = new + { + Success = true, + Message = "Files uploaded successfully", + // Additional data can be added here + }; + + return Json(responseData); + } + catch (Exception e) + { + var errorResponse = new + { + Success = false, + Message = "File upload failed: " + e.Message + }; + + return Json(errorResponse); + } + + // for String Data + try + { + // Process string data + var data = "success"; + // Return the string data + return Content(data); + } + catch (Exception) + { + var data = "failed"; + return Content(data); + } + + // for File Data + try + { + // Example: Retrieve file path for stream.txt + var filePath = "stream.txt"; // Example file path + + // Get full file path + var fullPath = Path.GetFullPath(filePath); + + // Return the file + return PhysicalFile(fullPath, "text/plain"); + } + catch (Exception e) + { + // Handle file retrieval failure + return Content("Failed to retrieve file response: " + e.Message, "text/plain"); + } +} + +``` + ## Remove action The remove action is optional. Specify the URL to handle remove process from server. From afc48948fc900aa64b847ed59aedd828b5203fe7 Mon Sep 17 00:00:00 2001 From: suresh Date: Mon, 22 Apr 2024 16:58:06 +0530 Subject: [PATCH 2/5] 83631: Provide support for catch the returned response body in upload --- .../uploader/EJ2_ASP.MVC/async.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md b/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md index 9e5f999ebc..0681eeca88 100644 --- a/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md +++ b/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md @@ -167,6 +167,69 @@ public void Save() } ``` +### Server-side configuration for save action with returned response + +Here’s how to handle the server-side action for saving the file in server with returned response. + +```c# +[AcceptVerbs("Post")] +public ActionResult Save() +{ + // for JSON Data + try + { + // Process uploaded data + var responseData = new + { + Success = true, + Message = "Files uploaded successfully", + // Additional data can be added here + }; + + return Json(responseData); + } + catch (Exception e) + { + var errorResponse = new + { + Success = false, + Message = "File upload failed: " + e.Message + }; + + return Json(errorResponse); + } + + // for String Data + try + { + // Process string data + var data = "success"; + // Return the string data + return Content(data); + } + catch (Exception) + { + var data = "failed"; + return Content(data); + } + + // for File Data + try + { + // Example: Retrieve file path for stream.txt + var filePath = "/stream.txt"; // Example file path + + // Return the file + return File(filePath, "text/plain"); + } + catch (Exception e) + { + return Content("Failed to retrieve file response: " + e.Message, "text/plain"); + } +} + +``` + ## Remove action The remove action is optional. Specify the URL to handle remove process from server. From 43daa99b39212f34966e80133e773217c04afdcc Mon Sep 17 00:00:00 2001 From: suresh Date: Mon, 22 Apr 2024 18:11:13 +0530 Subject: [PATCH 3/5] 83631: Provide support for catch the returned response body in upload --- ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md | 4 ++-- ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md b/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md index 0681eeca88..b9da37dd63 100644 --- a/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md +++ b/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md @@ -365,9 +365,9 @@ By default, the uploader control process multiple files to upload simultaneously -## Preload files +## Preloaded files -The uploader control allows you to preload the list of files that are uploaded in the server. The preloaded files are useful to view and remove the files from server that can be achieved by the [files](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Inputs.Uploader.html#Syncfusion_EJ2_Inputs_Uploader_Files) property. By default, the files are configured with uploaded successfully state on rendering file list. The following properties are mandatory to configure the preloaded files: +The uploader control allows you to preloaded the list of files that are uploaded in the server. The preloaded files are useful to view and remove the files from server that can be achieved by the [files](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Inputs.Uploader.html#Syncfusion_EJ2_Inputs_Uploader_Files) property. By default, the files are configured with uploaded successfully state on rendering file list. The following properties are mandatory to configure the preloaded files: * Name * Size diff --git a/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md b/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md index 5fc0ef7252..4cc9cd024f 100644 --- a/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md +++ b/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md @@ -460,9 +460,9 @@ By default, the uploader control process multiple files to upload simultaneously -## Preload files +## Preloaded files -The uploader control allows you to preload the list of files that are uploaded in the server. The preloaded files are useful to view and remove the files from server that can be achieved by the [files](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Inputs.Uploader.html#Syncfusion_EJ2_Inputs_Uploader_Files) property. By default, the files are configured with uploaded successfully state on rendering file list. The following properties are mandatory to configure the preloaded files: +The uploader control allows you to preloaded the list of files that are uploaded in the server. The preloaded files are useful to view and remove the files from server that can be achieved by the [files](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Inputs.Uploader.html#Syncfusion_EJ2_Inputs_Uploader_Files) property. By default, the files are configured with uploaded successfully state on rendering file list. The following properties are mandatory to configure the preloaded files: * Name * Size From 0bedc32fcf84e993ac234b103ac30b44d3671cfc Mon Sep 17 00:00:00 2001 From: suresh Date: Tue, 23 Apr 2024 16:37:05 +0530 Subject: [PATCH 4/5] 83631: Provide support for catch the returned response body in upload --- ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md | 4 ++-- ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md b/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md index b9da37dd63..da33d3618f 100644 --- a/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md +++ b/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md @@ -167,9 +167,9 @@ public void Save() } ``` -### Server-side configuration for save action with returned response +### Server-side configure save action to returned response -Here’s how to handle the server-side action for saving the file in server with returned response. +The following example demonstrates how the server-side action for saving the file in server to returned response in JSON, String and file type datas ```c# [AcceptVerbs("Post")] diff --git a/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md b/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md index 4cc9cd024f..9bed74ce30 100644 --- a/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md +++ b/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md @@ -202,9 +202,9 @@ public void Save(IList chunkFile, IList UploadFiles) ``` -### Server-side configuration for save action with returned response +### Server-side configure save action to returned response -Here’s how to handle the server-side action for saving the file in server with returned response. +The following example demonstrates how the server-side action for saving the file in server to returned response in JSON, String and File type datas. ```c# [AcceptVerbs("Post")] From 6a5b4d1170f78395c37f3e3101e6dbbcefea9e84 Mon Sep 17 00:00:00 2001 From: suresh Date: Tue, 23 Apr 2024 16:44:58 +0530 Subject: [PATCH 5/5] 83631: Provide support for catch the returned response body in upload --- ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md | 2 +- ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md b/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md index da33d3618f..baae05bd70 100644 --- a/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md +++ b/ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md @@ -169,7 +169,7 @@ public void Save() ### Server-side configure save action to returned response -The following example demonstrates how the server-side action for saving the file in server to returned response in JSON, String and file type datas +The following example demonstrates how the server-side action for saving the file in server to returned response in JSON, String and file type data's. ```c# [AcceptVerbs("Post")] diff --git a/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md b/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md index 9bed74ce30..15ba66d575 100644 --- a/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md +++ b/ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md @@ -204,7 +204,7 @@ public void Save(IList chunkFile, IList UploadFiles) ### Server-side configure save action to returned response -The following example demonstrates how the server-side action for saving the file in server to returned response in JSON, String and File type datas. +The following example demonstrates how the server-side action for saving the file in server to returned response in JSON, String and File type data's. ```c# [AcceptVerbs("Post")]