Browse Source
Merge pull request #3116 from zHaytam/dev
Add GetAllBytesAsync to AbpFormFileExtensions
pull/3136/head
maliming
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
0 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Http/AbpFormFileExtensions.cs
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System.IO; |
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
namespace Microsoft.AspNetCore.Http |
|
|
|
{ |
|
|
|
@ -11,5 +12,13 @@ namespace Microsoft.AspNetCore.Http |
|
|
|
return stream.GetAllBytes(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<byte[]> GetAllBytesAsync(this IFormFile file) |
|
|
|
{ |
|
|
|
using (var stream = file.OpenReadStream()) |
|
|
|
{ |
|
|
|
return await stream.GetAllBytesAsync(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|