GdPicture.NET.14
GdPicture14.WPF Namespace / GdViewer Class / DisplayFromFTP Method / DisplayFromFTP(String,String,String,String,Int32) Method
The name of the host server, where the file is located, for example ftp.gdpicture.com.
The file path on the host server for the document to display, 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
DisplayFromFTP(String,String,String,String,Int32) Method
In This Topic
Loads a document from a file stored on a distant server using FTP transfer according to what you have specified and subsequently displays it in the GdViewer control. The file transfer will be run asynchronously. The document previously displayed in the control will automatically close.

All document formats currently supported by the toolkit are listed here.

The DataReceived event is raised to allow you to monitor the transferred data. Likewise, the TransferEnded event is raised right after the transfer will finish.

Syntax
'Declaration
 
Public Overloads Function DisplayFromFTP( _
   ByVal Host As String, _
   ByVal Path As String, _
   ByVal Login As String, _
   ByVal Password As String, _
   ByVal FTPPort As Integer _
) As GdPictureStatus
public GdPictureStatus DisplayFromFTP( 
   string Host,
   string Path,
   string Login,
   string Password,
   int FTPPort
)
public function DisplayFromFTP( 
    Host: String;
    Path: String;
    Login: String;
    Password: String;
    FTPPort: Integer
): GdPictureStatus; 
public function DisplayFromFTP( 
   Host : String,
   Path : String,
   Login : String,
   Password : String,
   FTPPort : int
) : GdPictureStatus;
public: GdPictureStatus DisplayFromFTP( 
   string* Host,
   string* Path,
   string* Login,
   string* Password,
   int FTPPort
) 
public:
GdPictureStatus DisplayFromFTP( 
   String^ Host,
   String^ Path,
   String^ Login,
   String^ Password,
   int FTPPort
) 

Parameters

Host
The name of the host server, where the file is located, for example ftp.gdpicture.com.
Path
The file path on the host server for the document to display, 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.

Use the GetLastTransferError method to diagnose the error if this method has failed with one of the GdPictureStatus.Internet... errors.

Remarks
Just to remind you that both the DataReceived event and the TransferEnded event are raised to allow you to monitor the transfer progress.

Likewise, you can also utilize both the BeforeDocumentChange and the AfterDocumentChange events using this method.

Example
How to display your image from a distant server using the FTP transfer.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFTP("ftp.mywebsite.com", "/demo/image.tif", "login", "password", 21) = GdPictureStatus.OK Then
    'Do your stuff here.
Else
    MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromFTP")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFTP("ftp.mywebsite.com", "/demo/image.tif", "login", "password", 21) == GdPictureStatus.OK)
{
    //Do your stuff here.
}
else
{
    MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromFTP");
}
See Also