This repository was archived by the owner on May 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Cannot access file data #66
Copy link
Copy link
Open
Description
Hi,
when choosing a file, I can see the file details. But reading the file just does not work.
I do not know what excactly does not work. There is no exception.
When trying this code in VisualStudio the process (not Visual Studio but the started process) crashes.
On my deployed machine this does not happen but it does not work anyway.
This is my code:
<BlazorInputFile.InputFile OnChange="HandleFileSelected" MaxMessageSize="99999999" />
@if (file != null)
{
<p>Name: @file.Name</p>
<p>Size in bytes: @file.Size</p>
<p>Last modified date: @file.LastModified.ToShortDateString()</p>
<p>Content type (not always supplied by the browser): @file.Type</p>
}
<p>@status</p>
@code {
IFileListEntry file;
string status;
async Task HandleFileSelected(IFileListEntry[] files)
{
file = files.FirstOrDefault();
if (file != null)
{
// Just load into .NET memory to show it can be done
// Alternatively it could be saved to disk, or parsed in memory, or similar
var ms = new MemoryStream();
await file.Data.CopyToAsync(ms);
status = $"Finished loading {file.Size} bytes from {file.Name}";
}
}
}
I can see the first part with the filename and file size (96353 bytes).
But the status is never shown.
Metadata
Metadata
Assignees
Labels
No labels