-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
DoneThis issue has been fixedThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.
Milestone
Description
When I try out the new InputFile component in .NET 5 RC1 to upload some image files, the uploaded IBrowserFIle instances are missing the content type.
Repro steps:
- Install .NET 5 SDK 5.0.100-rc.1.20452.10
<InputFile OnChange="OnInputFileChange" multiple/>
<div class="image-list">
@foreach (var imageDataUrl in imageDataUrls)
{
<img src="@imageDataUrl" />
}
</div>
@code {
IList<string> imageDataUrls = new List<string>();
async Task OnInputFileChange(InputFileChangeEventArgs e)
{
// Inspect the content types here when uploading some images files
// Expected: image content types, Actual: no content type.
var imageFiles = e.GetMultipleFiles();// .Where(file => file.ContentType.StartsWith("image/"));
var format = "image/png";
foreach (var imageFile in imageFiles)
{
var resizedImageFile = await imageFile.RequestImageFileAsync(format, 100, 100);
var buffer = new byte[resizedImageFile.Size];
await resizedImageFile.OpenReadStream().ReadAsync(buffer);
var imageDataUrl = $"data:{format};base64,{Convert.ToBase64String(buffer)}";
imageDataUrls.Add(imageDataUrl);
}
}
}Metadata
Metadata
Assignees
Labels
DoneThis issue has been fixedThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.