We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

File upload and Save it into local folder


Need help on File upload and Save the uploaded file in  local folder in My computer. After saving when user clicks on "Get  Files" button, need to fetch all files from stored location and display on the screen.

Attachment: Fileupload_task_d9aedd8.zip

3 Replies

SP Sureshkumar P Syncfusion Team November 19, 2019 12:12 PM UTC

Hi Swathi, 
Greetings from Syncfusion support. 
We have validated your requirement. We can get the saved files details by using GetFiles method in C#,  that will return the names of files (including their paths) in the specified directory. 
Kindly refer to the below code block. 
<button id='btn' (click)="getFiles()">getFiles</button> 
getFiles() { 
      type: "POST", 
      url: 'http://localhost:61046/Home/GetFilesDetails', 
      success: function (data) { 
        for (let i: number = 0; i < data.length; i++) { 
          let filesData = data[i].split('\\'); 
          let length = filesData.length 
          console.log(filesData[length - 1]); 
        return data; 
      error: function () { 
        alert('Error occured'); 
        public string[] GetFilesDetails() 
            string path = hostingEnv.WebRootPath; // your saved files local path 
            return Directory.GetFiles(path); 
To know more about getFiles C# method. Please refer to the below documentation link: https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.getfiles?view=netframework-4.8  
Sureshkumar P 

SW Swathi November 19, 2019 12:20 PM UTC


Thanks for response, my question is in Angular how to upload and save files in local folder.(Example in C://Documents).
After that display the uploded files on the screen.

SP Sureshkumar P Syncfusion Team November 20, 2019 01:35 PM UTC

Hi Swathi, 
We have created a sample based on your requirement. Please find the sample here 
Also, we have created a video presentation for your reference. Please find the video presentation here: https://www.syncfusion.com/downloads/support/forum/149182/ze/ScreenCapture_11-20-2019_5.26.44_PM.xesc-1645996350  
Sureshkumar P  

Live Chat Icon For mobile
Up arrow icon