I am using the TelerikUpload component with UploadChunkSettings defined.
Telerik.UI.for.Blazor version 9.0.0
When not using a chunked upload I can return a response body a read it in the success handler, however when code was changed to use chunks the response body is always empty.
Is this a bug when using chunked upload, or do I need to return a different response in the Controller?
Code from the save method in Api Controller:
string chunkMetaData = formData["chunkMetaData"].ToString();
ChunkMetaData chunkData = JsonConvert.DeserializeObject<ChunkMetaData>(chunkMetaData);
// Append chunks to file
// ...
if (chunkData.TotalChunks - 1 == chunkData.ChunkIndex)
{
uploadComplete = true;
fs.Flush();
}
// More code omitted ...
if (uploadComplete)
{
Response.StatusCode = StatusCodes.Status200OK;
await Response.WriteAsync(result.ResultId.ToString());
return new EmptyResult();
}
else
{
Response.StatusCode = StatusCodes.Status201Created;
await Response.WriteAsync("Chunk upload successful.");
return new EmptyResult();
}
OnSuccess handler:
protected async Task SuccessHandler(UploadSuccessEventArgs args)
{
int resultid = 0;
if (int.TryParse(args.Request.ResponseText, out resultid))
{
// do something with the resultid
// ...
// args.Request.ResponseText is always empty when using chunked upload
}
}
According to the release notes for Telerik® UI for Blazor 13.2.0, this issue was fixed, but it doesn't look like it's actually fixed.
I am using v13.2.0, and am still seeing that the fields in Args.Request (ResponseText, ResponseType, Status, StatusText) are all null or 0 in the success handler when using chunked upload.
This works well with chunking disabled, but we need chunking to avoid file size/timeout restrictions. Any updates?
Please upgrade to version 13.3.0, which was released one day after 13.2.0. Version 13.2.0 has a problem with the JSInterop file, which affects some new features and fixes, including this one. Sorry about that.
Check the attached app.