Hi,
I followed the implementation and documentation for the upload here https://demos.telerik.com/aspnet-mvc/upload/events and it looks like the complete event should fire once when all files are uploaded. It does in your demo, but you are not using .ChunkSize
I am using the .ChunkSize and with that implementation, it fires a complete and success on each file. I expect the success to fire on each file but not the complete. I'm looking for some event to fire once all files are uploaded so I can process them server side. if this isn't the right implementation please suggest a way to accomplish that.
Here is code that generates n complete alerts where n is the number of files uploaded successfully:
Razor view:
<div>
@(Html.Kendo().Upload()
.Name("files")
.Async(a => a
.Save("Chunk_Upload_Save", "Home")
.ChunkSize(110000)
.AutoUpload(false)
)
.Events(events => events
.Complete("onComplete")
)
)
</div>
<script>
function onComplete(e) {
alert("Complete:");
}
</script>
Controller:
public ActionResult Chunk_Upload_Save(IEnumerable<HttpPostedFileBase> files, string metaData)
{
try
{
var ms = new MemoryStream(Encoding.UTF8.GetBytes(metaData));
var serializer = new DataContractJsonSerializer(typeof(ChunkMetaData));
var chunkData = (ChunkMetaData)serializer.ReadObject(ms);
ms.Close();
return Json(new FileResult
{
uploaded = chunkData.TotalChunks - 1 <= chunkData.ChunkIndex,
fileUid = chunkData.UploadUid
});
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}