Reputation: 9927
Could anyone guide me as to the best way to upload a collection of files from a directory to a server from within a WPF client. We have ftp access, and as such I have been looking at WebClient.UploadFile.
There seems to be a number of methods available through webclient though, and Im not sure which would be the most suitable.
Thanks in advance,
Upvotes: 1
Views: 1577
Reputation: 564741
Just use WebClient.UploadFile or WebClient.UploadFileAsync to upload the files, with one call per file.
This can be as simple as:
WebClient wc = new WebClient();
foreach(var filePath in files)
wc.UploadFile("ftp://myserver.com/path", filePath);
Upvotes: 1