public int upload(String SourceFilePath, FileInfo file1) { try { using (WebClient client = new WebClient()) { try { client.Credentials = mycreds; client.UploadFile(@"ftp:\\"+FTPIP +Path.GetFileName(SourceFilePath), SelectedPath + file1.Extension); } catch (Exception e2) { MessageBox.Show(e2.Message); } }
@"ftp:\\"
"ftp://"
... + FTPIP + Path.GetFileName(...
... + FTPIP + "/" + Path.GetFileName(...
void Upload(){ Web client = new WebClient(); client.Credentials = new NetworkCredential(username, password); client.BaseAddress = "ftp://ftpsample.net/"; client.UploadFile("sample.txt", "sample.txt"); //since the baseaddress }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)