I have searched and searched and cannot find a way to do this. I have files in a directory I want to upload. The file names change constantly so I cannot upload by file name. Here is what I have tried.
using (WebClient client = new WebClient())
{
client.Credentials = new NetworkCredential("User", "Password");
foreach (var filePath in files)
client.UploadFile("ftp://site.net//PICS_CAM1//", "STOR", @"PICS_CAM1");
}
But I am getting a compiler error:
The name 'files' does not exist in the current context
Everything I have researched says this should work.
Does anyone have a good way to upload a directory of files via WebClient
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…