h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Upload Multiple files into FTP Server using C#.net

Upload Multiple files into FTP Server using C#.Net

public static bool MultipleUploadFiles(string[] fileName, int candidateId, int resumeId)
{
try
{
string parentDir = string.Empty;
string candir = string.Empty;
string desPath = string.Empty;
foreach (string fName in fileName)
{
FileInfo objfileInfo = new FileInfo(fName);
parentDir = ClsConfigurations.ReadSetting("Folder");
candir = @"/" + parentDir + "/" + Convert.ToString(candidateId);
desPath = candir + "-" + Convert.ToString(resumeId) + objfileInfo.Extension;
CreateDirectory(candir);
objFTPCon.ServerDirectory = candir.Trim();
objFTPCon.UploadFile(fName, desPath);
}
return true;
}
catch (Exception ex)
{
Program.WriteLog(ex.Message, ex.StackTrace);
return false;
}
}