This is a migrated thread and some comments may be shown as answers.

React wrapper Upload control to netcore MVC controller

1 Answer 259 Views
Integration with other JS libraries
This is a migrated thread and some comments may be shown as answers.
Keith
Top achievements
Rank 1
Keith asked on 06 Feb 2018, 10:37 AM

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?

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 08 Feb 2018, 07:43 AM
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
Tags
Integration with other JS libraries
Asked by
Keith
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or