SaeedP
Well-known member
- Joined
- Oct 21, 2020
- Messages
- 116
- Programming Experience
- 3-5
Hello,
I need to import an image in my Blazor web assembly app. I have tested and read a lot of content from the web and AI.
But I don't know why none of my input tags are working!
Please guide me.
thanks,
I need to import an image in my Blazor web assembly app. I have tested and read a lot of content from the web and AI.
But I don't know why none of my input tags are working!
C#:
<InputFile @OnChange="HandleFileUpload" />
C#:
<input type="file" @onchange="HandleFileUpload" />
C#:
<input type="file" @onchange="HandleFileUpload" />
C#:
private async Task HandleFileUpload(InputFileChangeEventArgs e)
{
var file = e.File;
var buffer = new byte[file.Size];
await file.OpenReadStream().ReadAsync(buffer);
// Send the image to DeepAI for processing
var generatedAvatar = await GenerateAvatar(buffer);
// Display the generated avatar
avatarUrl = $"data:image/png;base64,{Convert.ToBase64String(generatedAvatar)}";
isImageUploaded = true;
isAvatarGenerated = true;
}
Please guide me.
thanks,