The full file path of the file to upload, for example "d:/images/myimage.jpg".
The host server name, for example "ftp.com".
The full file path of the file to create on the distant server, for example "/demo/image.jpg".
The user's login required to authenticate on the server.
The user's password required to authenticate on the server.
The FTP port number used. It is usually 21.
Example





In This Topic
GdPicture14 Namespace / GdPictureImaging Class / UploadFileToFTP Method

UploadFileToFTP Method (GdPictureImaging)

In This Topic
Uploads a specified file to a distant server using FTP transfer according to what you have specified.
Syntax
'Declaration
 
Public Function UploadFileToFTP( _
   ByVal FilePath As String, _
   ByVal Host As String, _
   ByVal Path As String, _
   ByVal Login As String, _
   ByVal Password As String, _
   ByVal FTPPort As Integer _
) As GdPictureStatus
public GdPictureStatus UploadFileToFTP( 
   string FilePath,
   string Host,
   string Path,
   string Login,
   string Password,
   int FTPPort
)
public function UploadFileToFTP( 
    FilePath: String;
    Host: String;
    Path: String;
    Login: String;
    Password: String;
    FTPPort: Integer
): GdPictureStatus; 
public function UploadFileToFTP( 
   FilePath : String,
   Host : String,
   Path : String,
   Login : String,
   Password : String,
   FTPPort : int
) : GdPictureStatus;
public: GdPictureStatus UploadFileToFTP( 
   string* FilePath,
   string* Host,
   string* Path,
   string* Login,
   string* Password,
   int FTPPort
) 
public:
GdPictureStatus UploadFileToFTP( 
   String^ FilePath,
   String^ Host,
   String^ Path,
   String^ Login,
   String^ Password,
   int FTPPort
) 

Parameters

FilePath
The full file path of the file to upload, for example "d:/images/myimage.jpg".
Host
The host server name, for example "ftp.com".
Path
The full file path of the file to create on the distant server, for example "/demo/image.jpg".
Login
The user's login required to authenticate on the server.
Password
The user's password required to authenticate on the server.
FTPPort
The FTP port number used. It is usually 21.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
Remarks

This method requires the Image Documents component to run.

Example
Uploading an image to a file located on a distant server using FTP transfer.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // Set the transferring options.
    gdpictureImaging.SetFtpPassiveMode(true);
    gdpictureImaging.SetHttpTransferBufferSize(2048);
    if (gdpictureImaging.UploadFileToFTP(@"D:\images\image.jpg", "ftp.com", "/demo/image.jpg", "user", "password", 21) != GdPictureStatus.OK)
    {
        MessageBox.Show("Uploading failed. Status: " + gdpictureImaging.GetStat() + "\nError: " + gdpictureImaging.GetLastTransferError(),
                        "Uploading using FTP", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
}
See Also