FIle type not allowed error when selecting from different directories

Hello,

I have the following uploader : 

<SfUploader @ref=@sfUploader AutoUpload=@false AllowedExtensions=".nzb" style="margin:5px;" MaxFileSize="50000000" AllowMultiple="true" Enabled=@(selectedNZBCategoryPath!= 0)>

                <UploaderEvents ValueChange="UploadOnChange" OnActionComplete="UploadComplete" />

</SfUploader>

When i select files from one directory everything works fine. When i select multiple files from different directories all files except one get the error "File type is not allowed". Any suggestions ?

Best regards

Christoph Weller



1 Reply

YS Yohapuja Selvakumaran Syncfusion Team September 26, 2024 01:30 PM UTC


Hi Christoph Weller


The behavior you’ve described aligns with the expected functionality of the native InputFile component in Blazor. When a user selects a file, the component stores the list of files locally and assigns an ID to each file. Reading the file using file.OpenReadStream relies on the file’s associated ID.


However, when a new file is selected, the InputFile component replaces the previous files with the new ones. As a result, trying to access the details of the last uploaded file may lead to an error, as the file associated with the original ID may no longer exist.


It’s important to note that the Syncfusion Uploader also follows a similar behavior to the native Blazor uploader in this regard.


To gain a deeper understanding of this functionality, you can refer to the following blog post:

https://www.meziantou.net/uploading-multiple-files-to-using-inputfile-in-blazor.htm 



To resolve the issue, you can either set AutoUpload to true, which will automatically upload the first file upon selection, or, if you need to set AutoUpload to false, you should ensure that the first file is uploaded before browsing and selecting a second file.



Regards,

Yohapuja S



Loader.
Up arrow icon