This question is locked. New answers and comments are not allowed.
I am using MVC Telerik Upload and while testing it I noticed that sometimes clientUpload is Null. I can't understand why some files are not uploaded though UploadFile action is called. I have tried numerous time to reproduce this on Dev machine without any luck but some users on Prod server reproduce this bug. Maybe someone could point me where could be the problem?
The code is below (version 2012.2.607.340)
@using (Html.BeginForm())
{
@(Html.Telerik().Upload()
.Name("clientUpload")
.Async(async => async
.Save("UploadFile", "File")
.Remove("Remove", "File")
.AutoUpload(false)
)
.ShowFileList(false)
.Multiple(true)
.ClientEvents(events => events
.OnUpload("onUpload")
)
)
}
function onUpload(e) {
e.data = serializeForm();
}
function serializeForm() {
var data = $("form").serializeArray();
var formData = {};
for (var i = 0; i < data.length; i++) {
formData[data[i].name] = data[i].value;
}
return formData;
}
[HttpPost]
public ActionResult UploadFile(IEnumerable<HttpPostedFileBase> clientUpload, [OptionModelBinder]IOptionModel formData)
{
//sometimes clientUpload is null
}
The code is below (version 2012.2.607.340)
@using (Html.BeginForm())
{
@(Html.Telerik().Upload()
.Name("clientUpload")
.Async(async => async
.Save("UploadFile", "File")
.Remove("Remove", "File")
.AutoUpload(false)
)
.ShowFileList(false)
.Multiple(true)
.ClientEvents(events => events
.OnUpload("onUpload")
)
)
}
function onUpload(e) {
e.data = serializeForm();
}
function serializeForm() {
var data = $("form").serializeArray();
var formData = {};
for (var i = 0; i < data.length; i++) {
formData[data[i].name] = data[i].value;
}
return formData;
}
[HttpPost]
public ActionResult UploadFile(IEnumerable<HttpPostedFileBase> clientUpload, [OptionModelBinder]IOptionModel formData)
{
//sometimes clientUpload is null
}