React wrapper Upload control to netcore MVC controller

2 posts, 0 answers
  1. Keith
    Keith avatar
    5 posts
    Member since:
    Dec 2017

    Posted 06 Feb 2018 Link to this post

    I am trying to upload a file using the ReactJS file upload wrapper, the file should be uploaded to a MVC netcore controller.  My is like:

    class ReconcileFile extends React.Component {
        constructor(props) {
            super(props);
     
            this.async = {
                saveUrl: "/reconcile/UploadFile",
                removeUrl: "http://my-app.localhost/remove",
                autoUpload: false          
            }
        }
        render() {
            return (
                <div>
                    <Upload async={this.async} />
                </div>
            );
        }
    }

    And my controller is:

    [HttpPost]
            async public Task<IActionResult> UploadFile([FromForm] IFormFile files)
            {
     
    }

     

    The value of files is always null.  I have tried with/without the FromFile attribute and have also tried using IEnumerable<IFromFile> as the receiving type.

     

    Any ideas?

  2. Stefan
    Admin
    Stefan avatar
    3012 posts

    Posted 08 Feb 2018 Link to this post

    Hello, Keith,

    Thank you for the information.

    I can suggest checking our MVC demo of the Upload, where the expected Controller configuration can be observed inside the AsyncController.cs file:

    https://demos.telerik.com/aspnet-mvc/upload/async

    If the value is still coming as null, please provide an example and I will gladly investigate further.

    Regards,
    Stefan
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top