|  |  | DynuFTP 2.0 |  |
|  |  |
Use this powerful yet easy to use FTP
component to perform all your uploads, downloads and other ftp commands all
from within your ASP pages. Get directory listings and perform literally any
command on the remote server! This component allows complete control over many
transfer options such as binary/ascii, passive mode (required by some
firewalls) etc.
Sample ASP code
set myftp = Server.CreateObject("DynuFTP.Functions")
REM the below line will download the file dynuftp.zip from
ftp.dynu.com.
if myftp.ExpressGetFile("ftp.dynu.com", "dynuftp.zip") then
Response.Write("Dowloaded file!")
end if
REM the below line will connect to the server ftp.dynu.com.
if myftp.connect("ftp.dynu.com") then
Response.Write("Connected to ftp site ftp.dynu.com")
end if
REM the below line will get the current directory as a string.
Response.Write(myftp.GetCurrentDirectory())
REM the below line will execute the command NOOP on the server.
Response.Write(myftp.ExecuteCommand("NOOP"))
set myftp = nothing
DynuFTP component has 9 methods and 1 property. Listed below is the
syntax for their use.
-
ExpressGetFile(server - string, remotefile - string,
[username - string], [password - string], [port - integer], [passive - BOOL],
[localfilename - string], [transfertype - string], [failifexists - BOOL])
Downloads file from FTP server with just one command.
Returns TRUE if file is downloaded successfully, else it will return FALSE.
-
ExpressPutFile(server - string, localfile - string,
[username - string], [password - string], [port - integer], [passive - BOOL],
[remotefilename - string], [transfertype - string], [failifexists - BOOL])
Uploads file to FTP server with just one command.
Returns TRUE if file is uploaded successfully, else it will return FALSE.
-
Connect(host - string, [port - int], [username -
string], [password -string], [acct - string], [fwhost - string], [fwusername -
string], [fwpassword - string], [fwport - integer], [logontype - integer],
[transfertype - string], [passive - Boolean])
Connects to an ftp server.
Returns TRUE if connection is established successfully, else it will return
FALSE.
This component supports 9 different login sequences. Below are the valid
logontypes to user with firewalls
-
0 - None
-
1 - Site hostname
-
2 - User after logon
-
3 - Proxy Open
-
4 - Transparent
-
5 - User with no logon
-
6 - User FireID@RemoteHost
-
7 - User remoteID@remoteHost fireID
-
8 - User remoteID@fireID@remoteHost
Below are the two valid transfer types(string).
-
ExecuteCommand(command - string)
Executes the given command on the FTP server.
Returns the result of the command as a string.
-
GetCurrentDirectory()
Returns the current directory on the FTP server as a string.
-
SetCurrentDirectory(directory - string)
Sets the current directory on the FTP server to the given directory.
Returns TRUE if successful, else it will return false.
-
GetFile(remotefile - string, [localfile - string],
[passive - Boolean], [transfertype - string])
Downloads the given remotefile.
Returns true if successful, else it will return FALSE.
-
PutFile(localfile - string, [remotefile - string],
[passive - Boolean], [transfertype - string])
Uploads the given localfile on to FTP server.
Returns true if successful, else it will return FALSE.
-
Close()
Disconnects from the FTP server if connected.
This method does not return anything.
-
ReturnMessage
This is a get property. This will contain the last message as a string returned
by the FTP server after performing any action on the server. NOTE: This
property is get only and cannot be set.
Click here to view sample
code.
|
|  |  |  |  |
    
| |