Upload component is not aware of upload errors

If I try to upload a file bigger than the allowed file size, the upload component calls the OnProgress function with 100% completion. The upload controller is not called as there is an error in the POST operation. The error I've got is this:

HTTP Error 404.13 - Not Found

The request filtering module is configured to deny a request that exceeds the request content length.

However, the blazor application does not get any error notification whatsoever, so it gets into an invalid state. I know that I can increment the file size limit in the application configuration files, but the point is that ther can be any error in the upload process (f.e. network error, server busy, etc) and the application would not get any feedback about it.

Please, add an onerror handler to the XMLHttpRequest in the javascript function upload to notify the upload component in case of any errors.

Hi @manu,

Sure thing. We will take care of this in one of the following Radzen releases.

I'd really like to have this added as well. I need the upload control to be able to handle the error coming back from the upload controller (I'm uploading a CSV file and then processing, and if it errors need to give error to user). Thanks!

Is there a solution to this topic? I'm trying to intercept when the user uploads a file with a wrong extension using the All files . selection in file type (I'm filtering only for pdf but all files is still there).
In the controller if the extension is not pdf I return a statuscode 400 with an error message and don't upload the file on the server.
But the component fires the upload complete and return 100% progress before firing the OnError event.
So it returns first the upload complete message and then an upload error message.

                        <RadzenUpload style="padding:2px 0px" Accept=".pdf" ChooseText="Cerca file" Url="@("upload/single?code="+prev.Code)" Visible="@(progress<100)" Error="@((args) => OnUploadError(args))" Complete="@((args) => OnComplete(args, "Upload"))" Progress="@((args) => OnProgress(args, "Upload"))" />


    public IActionResult Single(IFormFile file, string code)
    {
        try
        {
            if(file.FileName.EndsWith("pdf"))
            {
                UploadFile(file, code);
                return StatusCode(200);
            }
            else
            {
                return StatusCode(400, "Impossibile caricare files con estensione diversa da pdf");
            }
        }
        catch (Exception ex)
        {
            return StatusCode(500, ex.Message);
        }
    }