Not working aspose.network component for Uploading Folder which contains files to ftp server

Hi

I am prakash from MavinInfotech, India.

I have use this component. Is this use ful to upload entire local filesystem directory trees to an FTP server.

I need this functionality.

Can u send ASAP

Thanks & Regards

Prakash

ID: prakash@mavininfotech.com

Dear Prakash,

Thanks for your considering Aspose.

Our development team are doing something about supporting multiple files uploading. And we will provide you a workable solution next Monday.

Feel free to let me know if you have any problems.

Thanks again.

Dear Prakash,

here is the sample code for uploading directory.


static Aspose.Network.Ftp.FtpClient client;
static void Main(string[] args)
{
client = new Aspose.Network.Ftp.FtpClient("ftp://www.yourdomain.com", "user", "password");
client.Connect(true);
UploadFolder(@"c:\folder", "remote", true);
}

public void UploadFolder(string localFolderPath, string remotePath, bool recursive)
{
if (null == localFolderPath)//check param
{
throw new ArgumentNullException("localFolderPath");
}
if (0 >= localFolderPath.Length)//check param
{
throw new ArgumentException("localFolderPath should not be empty.");
}

if (null == remotePath)//check param
{
throw new ArgumentNullException("remotePath");
}


DirectoryInfo dir = new DirectoryInfo(localFolderPath);

Exception inner = null;
UploadFilesInFolder(remotePath, dir, out inner);//upload files in the local folder

if (inner != null)//if we get exception, throw it
throw inner;

if (recursive)//if recursive continue to upload subfolders
{
remotePath = string.Concat(remotePath, "/", dir.Name);
DirectoryInfo[] directories = dir.GetDirectories();
if (directories != null && directories.Length > 0)
{
foreach (DirectoryInfo d in directories)
{
UploadFolder(d.FullName, remotePath, recursive);
}
}
}


}

private void UploadFilesInFolder(string remotePath, DirectoryInfo dir, out Exception inner)
{
try
{
inner = null;
string destPath = string.Concat(remotePath, "/", dir.Name);

System.Diagnostics.Debug.WriteLine(destPath);
//create a new directory on the remote server.
client.MakeDirectory(destPath);

FileInfo[] files = dir.GetFiles();
if (files != null && files.Length > 0)
{
foreach (FileInfo file in files)
{
System.Diagnostics.Debug.WriteLine(file.FullName);
//upload the files
client.Upload(file.FullName, destPath + "/" + file.Name);
}
}

}
catch (Exception ex)
{
inner = ex;
}

}