Docs_ProcessEvent.razor
The CoreUploader has an event named UploaderEvent , when user browse or drop files the event will be fired , handle it like this :
<BlazorUploader.CoreUploader Multiple="true" UploaderEvent="HandleUploaderEvent">
<button class="btn btn-primary">Upload</button>
</BlazorUploader.CoreUploader>
In custom code , the BlazorUploader.UploaderFile object provide FileName,FileSize,MimeType, OpenReadOnlyStream etc.
@code{
void HandleUploaderEvent(BlazorUploader. UploaderEvent eventData)
{
if (eventData.FilesError.Length != 0)
{
// file has been rejected for MaxSizeKB/AcceptMimeTypes/AcceptExtensions etc..
// developer shall show error , or ignore it.
}
if (eventData.FilesAdded.Length != 0)
{
foreach (BlazorUploader.UploaderFile file in eventData.FilesAdded)
{
//manually validate the file.
string name = file.FileName;
long size = file.FileSize;
//read data from the stream
using Stream livestream = file.OpenReadOnlyStream();
//for more details , check the /MyUploaderState.cs in the demo project
}
}
}
}
for more details , check the /MyUploaderState.cs in the demo project