Esempio n. 1
0
        private async Task <UploadStartResponse> Upload(UploadRequestFinish model, CancellationToken token)
        {
            var tempDataProvider = _tempDataDictionaryFactory.GetTempData(HttpContext);
            var tempData2        = tempDataProvider.Get <TempData>($"update-{model.SessionId}");

            tempDataProvider.Remove($"update-{model.SessionId}");

            var indexes = new List <int>();

            for (double i = 0; i < tempData2.Size; i += UploadInnerResponse.BlockSize)
            {
                indexes.Add((int)(i / UploadInnerResponse.BlockSize));
            }

            //original file name can only have ascii chars. hebrew not supported. remove that
            await BlobProvider.CommitBlockListAsync(tempData2.BlobName, tempData2.MimeType, null, indexes, null, token);

            var result = tempData2.BlobName;

            await FinishUploadAsync(model, result, token);

            return(new UploadStartResponse(result));
        }