For my use case I simply need to know if they selected a file, no different that if they filled in a text box or selected a value from a drop down etc.
If the upload fails, is that not the same as anything else failing within FormSubmit()?
Here is my current work around
protected async Task FormSubmit()
{
try
{
if (upload.HasValue)
{
await upload.Upload();
}
else
{
errorVisible = true;
}
}
catch (Exception ex)
{
errorVisible = true;
}
}
As written it doesn't know if the upload specifically failed or it was something else, but if you have a lot of things happening in your FormSubmit() it would be no different.
I changed my error message to "Cannot save, did you select your file?" which is intended to say to the end user: something didn't work, it could be you didn't select the file but it could be something else.