Hi Syncfusion Team and fellow Devs,
for some reason the File Upload stopped working in one of my Apps as i moved to .NET 6, so I created a new Blazor WASM (hosted) App and tried to rebuild it from scratch, according to your documentation.
https://blazor.syncfusion.com/documentation/file-upload/getting-started
Here are the steps:
builder.Services.AddSyncfusionBlazor();
<link rel='nofollow' href="_content/Syncfusion.Blazor.Themes/bootstrap4.css" rel="stylesheet" />@using System.IO
<SfUploader AutoUpload="false">
<UploaderEvents ValueChange="OnChange"></UploaderEvents>
</SfUploader>
@code {
private void OnChange(UploadChangeEventArgs args)
{
foreach (var file in args.Files)
{
var path = @"D:\" + file.FileInfo.Name;
FileStream filestream = new FileStream(path, FileMode.Create, FileAccess.Write);
file.Stream.WriteTo(filestream);
filestream.Close();
file.Stream.Close();
}
}
}
Uploader says the file is successfully uploaded but the File never gets created. Am I missing something here?
Hi Syncfusion Support,
oh boy, that was a mistake of mine. I switched from Blazor Server to WASM. That's why this can't work. Nevertheless, after creating a Controller according to the documentation the Count of IList<IFormFile> UploadFiles was always 0. I managed to get the files with this:
var files = Request.Form.Files;
Anyways, thank you and you can close this Thread.