ftp server

Is it possible to use the fileupload component to save files in a ftp server ?
I'm using this approach but it doesn't work. 
I don't receive any error but the file is not saved even if I have permissions to create files on the NAS where an ftp server is running


<SfUploader AutoUpload="true" Multiple=false>
                      <UploaderEvents ValueChange="OnChange"></UploaderEvents>
</SfUploader>

@code {
    private void OnChange(UploadChangeEventArgs args)
    {
        foreach (var file in args.Files)
        {
            var path = @"ftp://username:password@<NAS address>" + file.FileInfo.Name;
            FileStream filestream = new FileStream(path, FileMode.Create, FileAccess.Write);
            file.Stream.WriteTo(filestream);
            filestream.Close();
            file.Stream.Close();
        }
    }
}

3 Replies 1 reply marked as answer

SP Sureshkumar P Syncfusion Team November 9, 2020 12:43 PM UTC

Hi Walter, 
 
Greetings from Syncfusion support. 
 
Based on your shared information with code example, we suspect that you change the file.Stream.WriteTo method as like below documentation to achieve your requirement. 
 
Please find the online common forum documentation to know the Upload files with FTP. 
 
Documentation links 
 
Regards, 
Sureshkumar P 


Marked as answer

WM Walter Martin November 10, 2020 12:40 PM UTC

many thanks, you're right 
using the code in the common documentation it works
 


SN Sevvandhi Nagulan Syncfusion Team November 11, 2020 04:19 AM UTC

Hi Walter, 


Thanks for the update. Please let us know if you need further assistance. 


Regards, 
Sevvandhi N 


Loader.
Up arrow icon