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
}
}