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

How to pass uploaded files from Modal window to controller?

1 Answer 466 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Daochuen
Top achievements
Rank 1
Iron
Veteran
Iron
Daochuen asked on 11 Mar 2019, 06:01 AM

 

 

Hello,

I have Kendo Upload control inside kendo modal window ("kendoWindow") in my MVC project. How do I use ajax call to pass uploaded file to server/Controller?

 Thanks  

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 12 Mar 2019, 03:49 PM
Hello,

See Murat's reply in this stackoverflow thread, which shows a possible approach of sending the selected files in the Upload to the controller with an AJAX request. It consists of preventing the form's submission and sending the formdata with an AJAX request to the Create action. Note that a button to trigger the form submission is missing from hes View snippet:
<button>Submit</button>

The Create action can be declared without a model parameter, in case you don't need it:
[HttpPost]
public ActionResult Create(IEnumerable<HttpPostedFileBase> files)
{
//...
}

You should be able to access the uploaded files through the files parameter, which should match the name of the Upload itself:
.Name("files")


Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Upload
Asked by
Daochuen
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Ivan Danchev
Telerik team
Share this question
or