Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

5
Votes

I fell over a quite stupid issue with the file upload component.

That no other people fall over the same thing, please add a hint to the page under 

https://ej2.syncfusion.com/blazor/documentation/uploader/async/#multiple-file-upload to inform the developers that the 'ID' fields must be exactly matching the parameter name for the save file method in the controller.


E.g.


<EjsUploader ID="UploadFiles" Multiple=false>
<UploaderAsyncSettings SaveUrl="api/SampleData/Save" RemoveUrl="api/SampleData/Remove">
</UploaderAsyncSettings>
</EjsUploader>


with the controller method like this:

[HttpPost("[action]")]
    public void Save(IList<IFormFile> files)
    {
        long size = 0;
        try
        {
            foreach (var file in UploadFiles)
            {
                var filename = ContentDispositionHeaderValue
                        .Parse(file.ContentDisposition)
                        .FileName
                        .Trim('"');
                    filename = hostingEnv.ContentRootPath + $@"\{filename}";
                    size += (int)file.Length;
                if (!System.IO.File.Exists(filename))
                {
                    using (FileStream fs = System.IO.File.Create(filename))
                    {
                        file.CopyTo(fs);
                        fs.Flush();
                    }
                }
            }
        }
        catch (Exception e)
        {
            Response.Clear();
            Response.StatusCode = 204;
            Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = "File failed to upload";
            Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = e.Message;
        }
    }

will not work, because the ID is "UploadFiles" while the parameter name is "files". There is no documentation about this behaviour...

Proposal: Add a hint on the page to clearify this behaviour.