QFtpConnection Class

Constructors

  Name Description
QFtpConnection(string server, string username, string password) Initializes new instance of the QFtpConnection class.
QFtpConnection(string server, string username, string password, string serverPath ) Initializes new instance of the QFtpConnection class.

Ftp File Methods

  Name Description
DownloadFile(string ftpPath, string outputPath, System.ComponentMode.BackgroundWorker worker) Downloads a file from the ftp server and reports progress through the background worker
UploadFile(string sourcePath, string ftpPath, System.ComponentMode.BackgroundWorker worker) Uploads a file to the ftp server and reports progress through the background worker
DeleteFile(string ftpPath, System.ComponentModel.BackgroundWorker worker)
Delete a file from the ftp server and reports progress through the background worker
DeleteFile(string ftpPath) Delete a file from the Ftp server
RenameFile(string ftpPath, string name) Rename a file on the ftp server
MoveFile(string ftpSourcePath, string ftpOutputPath) Move a file to another directory on the ftp server

Ftp Directory Methods

  Name Description
CreateDirectory(string ftpPath) Create a new directory on the ftp server
DeleteDirectory(string ftpPath, System.ComponentModel.BackgroundWorker worker) Delete a directory from the ftp server and reports progress through the backgroundworker
DeleteDirectory(string ftpPath)
Delete a directory from the ftp server
RenameDirectory(string ftpPath, string name) Rename a directory on the ftp server
MoveDirectory(string ftpSourcePath, string ftpOutputPath) Move a directory to another directory on the ftp server

FtpFile Properties

  Name Description
QFtpFileInfo[] GetFiles(string ftpPath) Gets an QFtpfileInfo array from a directory on the ftp server
QFtpFileInfo GetFile(string ftpPath) Gets an QFtpfileInfo from a directory on the ftp server
long GetFileLength(string ftpPath) Gets the file length in bytes from a file on the ftp server
bool FileExists(string ftpPath) Gets a return value determining if the file exists on the ftp server

Ftp Directory Properties

  Name Description
QFtpFolderInfo[] GetDirectories(string ftpPath) Gets an QFtpFolderInfo array from a directory on the ftp server
QFtpFolderInfo GetDirectory(string ftpPath) Gets an QFtpFolderInfo from a directory on the ftp server
bool DirectoryExists(string ftpPath) Gets a return value determining if the directory exists on the ftp server

Ftp DateTime Properties

  Name Description
DateTime GetCreationTime(string ftpPath) Gets the file or directory CreationTime DateTime
DateTime GetCreationTimeUtc(string ftpPath) Gets the file or directory Universal CreationTime DateTime
DateTime GetLastAccessTime(string ftpPath) Gets the file or directory LastAccessTime DateTime
DateTime GetLastAccessTimeUtc(string ftpPath) Gets the file or directory Universal LastAccessTime DateTime
DateTime GetLastWriteTime(string ftpPath)) Gets the file or directory LastWriteTime DateTime
DateTime GetLastWriteTimeUtc(string ftpPath) Gets the file or directory Universal LastWriteTime DateTime

QFtpConnection (Ftp File Example)

// create & initialize BackgroundWorker to get ftp status reports 
BackgroundWorker backgroundTask = new BackgroundWorker();

// create & initialize ftpConnection object (host, username, password)
QFtpConnection ftpConnection = new QFtpConnection("yourwebsite.com","admin", "S@k78s");

// downloads a file from ftp server into destination folder on drive
ftpConnection.DownloadFile("ftp://yourwebsite.com/images/avavar.png", "C:\\Users\\Thoosje\\Downloads\\avatar.png", backgroundTask);

// uploads a file from drive into destination folder on Ftp Server
ftpConnection.UploadFile("C:\\Users\\Thoosje\\Downloads\\logo.png", "ftp://yourwebsite.com/images/logo.png", backgroundTask);

// delete file on Ftp Server
ftpConnection.DeleteFile("ftp://yourwebsite.com/images/logo.png");

// rename file on Ftp Server
ftpConnection.RenameFile("ftp://yourwebsite.com/images/logo.png", "renamedLogo.png");

// move file on Ftp Server
ftpConnection.MoveFile("ftp://yourwebsite.com/images/logo.png", "ftp://yourwebsite.com/images/backup/logo.png");

QFtpConnection (Ftp Directory Example)

// create & initialize BackgroundWorker to get ftp status reports 
BackgroundWorker backgroundTask = new BackgroundWorker();

// create & initialize ftpConnection object (host, username, password)
QFtpConnection ftpConnection = new QFtpConnection("yourwebsite.com","admin", "S@k78s");

// create new directory into destination folder on the Ftp Server
ftpConnection.CreateDirectory("ftp://yourwebsite.com/images/newfolder");

// rename folder on Ftp Server
ftpConnection.RenameDirectory("ftp://yourwebsite.com/images/newfolder", "oldfolder");

// move directory to another directory on Ftp Server
ftpConnection.MoveDirectory("ftp://yourwebsite.com/images/newfolder", "ftp://yourwebsite.com/images/backup/newfolder");

// delete folder on Ftp Server
ftpConnection.DeleteDirectory("ftp://yourwebsite.com/images/newfolder");

// delete folder on Ftp Server with background worker ftp status reports
ftpConnection.DeleteDirectory("ftp://yourwebsite.com/images/newfolder", backgroundTask)