A question about uploading files to an FTP server using FluentFTP
See original GitHub issueFirst of all, thank you for making tusdotnet project to provide dotnet developers with the ability of using Tus.
I am using tusdotnet in my asp.net core 3.1 project with uppy and react and I have a question about uploading files to an FTP server with FluentFTP.
I can connect to my FTP server through FluentFTP and upload files like this:
using FluentFTP;
// creating FTP client
FtpClient client = new FtpClient(_baseUri, _port, _username, _password);
// Connecting to the FTP server
await client.ConnectAsync();
using (var stream = file.OpenReadStream())
{
...
// Uploading file to the FTP server
var ftpStatus = await client.UploadAsync(stream, fileRelativePath);
...
}
// disconnect!
await client.DisconnectAsync();
I have read some articles in wiki of tusdotnet repo about its interfaces. If I should change any implementation please explain which methods need to be changed in new implementation and how could I make tusdotnet to use new implementation instead of its default implementation.
The question is, how can I use tusdotnet in a way that I can upload files directly to the FTP server using FluentFTP?
Thank you in advance…
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
I’m actually doing something similar - in my case using tus as an upload protocol for embedded controllers on an Edge server and then FTPing received files to a final destination on a different server. I hadn’t considered creating an FTP backend for tusdotnet, but I don’t think I’d want to. In my scenario it’s better to collect files on the edge server if the network is down.
My strategy is this:
That may or may not suit your needs, but I’ve had good success with it thus far in dev.
Hi!
What you are looking for is a custom store so start by reading this article: https://github.com/tusdotnet/tusdotnet/wiki/Custom-data-store
The interfaces that your store need to implement depends on what extensions from the tus protocol you need as each interface represent an extension.
As a baseline you need to implement
ITusStore
to have support for the core protocol and probably alsoITusCreationStore
to be able to create new files.Then pass your own store to the setup of tusdotnet: