Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

component unable to open file when using Mode.Buffer

$
0
0
<FluentInputFile     DragDropZoneVisible="false"    Mode="InputFileMode.Buffer"    MaximumFileSize=10485760    BufferSize="10485760"     Multiple="false"    AnchorId="MyUploadButton"    Accept=".jpg,.doc,.docx,.pdf,.jpeg,.gif"    OnCompleted="@OnCompletedAsync" />

https://www.fluentui-blazor.net/InputFileI’m using the FluentInputFile component to upload files and save the data from file.Buffer.Data to a file on a SharePoint site(the SharePoint API requires the file content in byte array format). However, I’m unable to open the file because it appears to be damaged. I also tried saving file.Buffer.Data to a local file, but I was still unable to open it. Here’s the code I used to save it locally.

    private async Task OnCompletedAsync(IEnumerable<FluentInputFileEventArgs> files)    {    var buffer = new byte[file.Size];    buffer = file.Buffer.Data;    car path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", file.Name);    System.IO.File.WriteAllBytes(path, buffer);    }

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>