- Home
- Forum
- Angular - EJ 2
- Angular file explorer after upload a file i need to create a message popup once its reached the max allocated memory
Angular file explorer after upload a file i need to create a message popup once its reached the max allocated memory
Hello,
I'm using angular file manager and aspnet core web api in a project.
in file manager we are uploading files and validating files and given as response custom message.
but I am unable to use failure method to capture the response from server
Client side:
onUploadFail(args)
{
let response = JSON.parse(args.e.target.response);
args.statusText = response.message;
console.log(response.message);
}
Server side:
Response.Clear();
Response.ContentType = "application/json; charset=utf-8";
Response.StatusCode = 404; //200
Response.Headers.Add("status","Custom Message");
if I send the statuscode as 404 means it will automatically trigger, file already exists popup, Instead of that I need to show a custom popup message.
kindly share the sample if available.
|
// uploads the file(s) into a specified path
[Route("Upload")]
public IActionResult Upload(string path, IList<IFormFile> uploadFiles, string action)
{
FileManagerResponse uploadResponse;
uploadResponse = operation.Upload(path, uploadFiles, action, null);
if (uploadResponse.Error != null)
{
Response.Clear();
Response.ContentType = "application/json; charset=utf-8";
Response.StatusCode = Convert.ToInt32(uploadResponse.Error.Code);
Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = "Custom message";
}
return Content("");
} |
|
<div class="sample-container">
<ejs-filemanager
id="filemanager"
[ajaxSettings]="ajaxSettings"
(failure)="onFail($event)"
>
</ejs-filemanager>
</div>
onFail(args) {
console.log(args.error.statusText);
}
|
|
|
- 1 Reply
- 2 Participants
- Marked answer
-
KA karthick
- Dec 28, 2020 07:36 AM UTC
- Dec 29, 2020 10:14 AM UTC