ReadAsMultipartAsync in Asp.net Core

2.4k views Asked by At

i want use resumable.js in asp.net core but some codes not work in .net core , Example :

private async Task<bool> readPart(MultipartFormDataStreamProvider provider)
{
    try
    {

        await  Request.Content.ReadAsMultipartAsync(provider);

        ResumableConfiguration configuration = GetUploadConfiguration(provider);
                int chunkNumber = GetChunkNumber(provider);

        // Rename generated file
        MultipartFileData chunk = provider.FileData[0]; // Only one file in multipart message
                RenameChunk(chunk, chunkNumber, configuration.Identifier);

        // Assemble chunks into single file if they're all here
        TryAssembleFile(configuration);
                return true;
    }
    catch 
    {
        return false;
    }
}

how to change Request.Content.ReadAsMultipartAsync for use in .net core ?

ResumableController.cs

1

There are 1 answers

1
HMZ On

According to the devs this extension has been updated for .net core. See this issue on github.

Just download this nuget package and the extension will be available:

Microsoft.AspNet.WebApi.Client