You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ej2-asp-core-mvc/uploader/EJ2_ASP.MVC/async.md
+65-2Lines changed: 65 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -167,6 +167,69 @@ public void Save()
167
167
}
168
168
```
169
169
170
+
### Server-side configure save action to returned response
171
+
172
+
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.
173
+
174
+
```c#
175
+
[AcceptVerbs("Post")]
176
+
publicActionResultSave()
177
+
{
178
+
// for JSON Data
179
+
try
180
+
{
181
+
// Process uploaded data
182
+
varresponseData=new
183
+
{
184
+
Success=true,
185
+
Message="Files uploaded successfully",
186
+
// Additional data can be added here
187
+
};
188
+
189
+
returnJson(responseData);
190
+
}
191
+
catch (Exceptione)
192
+
{
193
+
varerrorResponse=new
194
+
{
195
+
Success=false,
196
+
Message="File upload failed: "+e.Message
197
+
};
198
+
199
+
returnJson(errorResponse);
200
+
}
201
+
202
+
// for String Data
203
+
try
204
+
{
205
+
// Process string data
206
+
vardata="success";
207
+
// Return the string data
208
+
returnContent(data);
209
+
}
210
+
catch (Exception)
211
+
{
212
+
vardata="failed";
213
+
returnContent(data);
214
+
}
215
+
216
+
// for File Data
217
+
try
218
+
{
219
+
// Example: Retrieve file path for stream.txt
220
+
varfilePath="/stream.txt"; // Example file path
221
+
222
+
// Return the file
223
+
returnFile(filePath, "text/plain");
224
+
}
225
+
catch (Exceptione)
226
+
{
227
+
returnContent("Failed to retrieve file response: "+e.Message, "text/plain");
228
+
}
229
+
}
230
+
231
+
```
232
+
170
233
## Remove action
171
234
172
235
The remove action is optional. Specify the URL to handle remove process from server.
@@ -302,9 +365,9 @@ By default, the uploader control process multiple files to upload simultaneously
302
365
303
366
304
367
305
-
## Preload files
368
+
## Preloaded files
306
369
307
-
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:
370
+
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:
Copy file name to clipboardExpand all lines: ej2-asp-core-mvc/uploader/EJ2_ASP.NETCORE/async.md
+69-2Lines changed: 69 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -202,6 +202,73 @@ public void Save(IList<IFormFile> chunkFile, IList<IFormFile> UploadFiles)
202
202
203
203
```
204
204
205
+
### Server-side configure save action to returned response
206
+
207
+
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.
208
+
209
+
```c#
210
+
[AcceptVerbs("Post")]
211
+
publicIActionResultSave()
212
+
{
213
+
// for JSON Data
214
+
try
215
+
{
216
+
// Process uploaded data
217
+
varresponseData=new
218
+
{
219
+
Success=true,
220
+
Message="Files uploaded successfully",
221
+
// Additional data can be added here
222
+
};
223
+
224
+
returnJson(responseData);
225
+
}
226
+
catch (Exceptione)
227
+
{
228
+
varerrorResponse=new
229
+
{
230
+
Success=false,
231
+
Message="File upload failed: "+e.Message
232
+
};
233
+
234
+
returnJson(errorResponse);
235
+
}
236
+
237
+
// for String Data
238
+
try
239
+
{
240
+
// Process string data
241
+
vardata="success";
242
+
// Return the string data
243
+
returnContent(data);
244
+
}
245
+
catch (Exception)
246
+
{
247
+
vardata="failed";
248
+
returnContent(data);
249
+
}
250
+
251
+
// for File Data
252
+
try
253
+
{
254
+
// Example: Retrieve file path for stream.txt
255
+
varfilePath="stream.txt"; // Example file path
256
+
257
+
// Get full file path
258
+
varfullPath=Path.GetFullPath(filePath);
259
+
260
+
// Return the file
261
+
returnPhysicalFile(fullPath, "text/plain");
262
+
}
263
+
catch (Exceptione)
264
+
{
265
+
// Handle file retrieval failure
266
+
returnContent("Failed to retrieve file response: "+e.Message, "text/plain");
267
+
}
268
+
}
269
+
270
+
```
271
+
205
272
## Remove action
206
273
207
274
The remove action is optional. Specify the URL to handle remove process from server.
@@ -393,9 +460,9 @@ By default, the uploader control process multiple files to upload simultaneously
393
460
394
461
395
462
396
-
## Preload files
463
+
## Preloaded files
397
464
398
-
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:
465
+
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:
0 commit comments