Folder upload

I'm trying to upload folders with subfolders and files with drag and drop. For example I drop folder "abc" which has subfolders "b" and "d". Folder "b" has file "aa.txt".



@code {
private void OnChange(UploadChangeEventArgs args)
{
}
public void OnSelect(SelectedEventArgs args)
{
//Triggers after selecting or dropping the files by adding the files in upload queue.
}
}
In callback I have only reference to top folder "abc". How can I traverse through all subfolders? So I can get all folders (abc, b, d) and the file "aa.txt".

8 Replies

BC Berly Christopher Syncfusion Team May 18, 2021 08:45 AM UTC

Hi Frantisek, 
  
Greetings from Syncfusion support. 
  
While checking the reported issue, we got the files data correctly while drag and drop the folder along with sub folder. Kindly refer the below screenshot. Here, we have uploaded the “Screenshot (1).png” from the folder “Saved Pictures/a” which is obtained correctly in the selected event arguments. 
  
 
  
  
Please check the above sample and share the below details that will help us to check and confirm the issue from our end. 
  
1.       Code snippet of Uploader component rendering  
2.       Syncfusion NuGet version 
3.       Simple issue reproducing sample or modify the attached sample with reported issue. 
  
Regards, 
Berly B.C  



FJ frantisek jukl May 20, 2021 08:39 AM UTC

Hello, I'm using webassembly. My question originated from this sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Upload_Select1184020022


BC Berly Christopher Syncfusion Team May 21, 2021 10:42 AM UTC

Hi Frantisek, 
  
We have checked the shared sample. In the shared sample you did not enable the directory upload and trying to upload the directory by drag and drop action. Due to this, selected folder name has been considered as file and displayed in the selected event arguments. So, we suggest you to enable the DirectoryUpload as mentioned below code example to get rid of the reported issue. 
  
  
  
<SfUploader AutoUpload="false" DirectoryUpload="true"> 
    <UploaderEvents ValueChange="OnChange" FileSelected="OnSelect"></UploaderEvents> 
</SfUploader> 
 
  
Here, we have drag and drop the folder named as “abc” which is consists of file name “aaa.txt”. We can get this file name in the selected event arguments.  
  
 
  
  
Regards, 
Berly B.C 



FJ frantisek jukl May 21, 2021 12:22 PM UTC

Hello, with your modified sample I got error after drop:





BC Berly Christopher Syncfusion Team May 24, 2021 06:49 AM UTC

Hi Frantisek, 

We have already logged the reported issue as a bug at our end and this fix will be included in our upcoming release on 1st June 2021. We appreciate your patience until then. 

Please track the status of this feedback from the below link. 


Regards, 
Berly B.C 



BC Berly Christopher Syncfusion Team June 1, 2021 09:44 AM UTC

Hi Frantisek, 
  
Thanks for the patience.     
  
We are glad to announce that our latest release in the version 19.1.66 has been rolled out successfully and in that release, we have included the “While drag and drop the folder along with sub folder, Uploader throws console error”.  So, we suggest you upgrade our Syncfusion packages to the latest version to resolve this issue in your end. 
  
  
  
Regards, 
Berly B.C 



FJ frantisek jukl June 4, 2021 11:21 AM UTC

Hello, the fix is ok. Now the Uploader shows file with path. Can I somehow get empty folders (get folder "d" from the structure)?



BC Berly Christopher Syncfusion Team June 7, 2021 12:14 PM UTC

Hi Frantisek, 
  
Sorry for the inconvenience caused. 
  
By default, we couldn't choose an empty directory from the Uploader component because none of the events would be triggered at that moment. The HTML 5 File Upload component has been added to the Syncfusion Blazor Uploader component. When uploading an empty directory to the HTML 5 Upload, this is the default behaviour. 
  
So, please share the use case for detecting empty directory in the Uploader component this information will help us to check and proceed further from our end. 
  
Regards, 
Berly B.C  


Loader.
Up arrow icon