This question is locked. New answers and comments are not allowed.
I am using telerik file upload control for my MVC3 application. I am using its asynchronous feature to upload the files. Below is the code that I am using.
@(Html.Telerik().Upload()
.Name("files")
.ShowFileList(true)
.Multiple(true)
.Async(
async => async
.Save("Save", "MyController")
.AutoUpload(false)
.Remove("Remove", "MyController")
)
)
[HttpPost]
public ActionResult Save(IEnumerable<HttpPostedFileBase> files)
{
foreach (var file in files)
{
// Some browsers send file names with full path. We only care about the file name.
var fileName = Path.GetFileName(file.FileName);
var destinationPath = Path.Combine(Server.MapPath("~/App_Data"), fileName);
file.SaveAs(destinationPath);
}
return Content("");
}
The above piece of code will generate two buttons viz. "Select" and "Upload files". After selecting 4 files and pressing "upload files" button, the telerik calls the action method 4 times asynchronously (which is bad). What I wanted was the method should be called only once and all the 4 files should be send to the method at once (as I am accepting list of files).
So, How can I achieve this in Html.Telerik().Upload() control?
Also, I will be showing this control in my Html.Telerik().Window(), So I will need to send uploaded data to my parent page. Any helps how to do this too?
Thanks.