Whatever message this page gives is out now! Go check it out!
<cfftp
action = "action"
ASCIIExtensionList = "extensions"
connection = "connection name"
directory = "directory name"
existing = "file or directory name"
failIfExists = "yes|no"
item = "directory or file"
localFile = "filename"
name = "query name"
new = "file or directory name"
passive = "yes|no"
password = "password"
proxyServer = "proxy server"
remoteFile = "filename"
result = "result name"
server = "server"
systemtype = "windows | unix"
timeout = "time-out in seconds"
transferMode = "ASCII FTP|Binary FTP|Auto FTP"
username = "name"><cfscript>
cfftp(action="action", ASCIIExtensionList = "extensions", connection = "connection name", directory = "directory name", existing = "file or directory name", failIfExists = "yes|no", item = "directory or file", localFile = "filename", name = "query name", new = "file or directory name", passive = "yes|no", password = "password", proxyServer = "proxy server", remoteFile = "filename", result = "result name", server = "server", systemtype = "windows | unix", timeout = "time-out in seconds", transferMode = "ASCII FTP|Binary FTP|Auto FTP", username = "name")
</cfscript>Attribute | Req/Opt | Default | Description |
action | Required if connection is not cached | FTP operation to perform:
| |
ASCIIExtensionList | Optional | txt;htm;html; cfm;cfml;shtm; shtml;css;asp;asa | Delimited list of file extensions that force ASCII transfer mode, if transferMode = "auto". |
connection | Required if action = "open" or "closed" | The name of the FTP connection.Used to cache a new FTP connection or to reuse an existing connection. | |
directory | Required if action = "changedir", "createDir", "listDir", or "existsDir" | Directory on which to perform an operation. | |
existing | Required if action = "rename" | Current name of the file or directory on the remote server. | |
failIfExists | Optional | yes |
|
item | Required if action = "exists" or "remove" | Object of these actions: file or directory. | |
localFile | Required if action = "getFile" or "putFile" | Name of the file on the local file system. For more information, see Usage. | |
name | Required if action = "listDir" | Query name of directory listing. | |
new | Required if action = "rename" | New name of file or directory on the remote server. | |
passive | Optional | no |
|
password | Required if action = "open" | Password to log in the user. | |
proxyServer | Optional | String. Name of the proxy servers to use, if proxy access is specified. | |
remoteFile | Required if action = "getFile", "putFile", or "existsFile" | Name of the file on the FTP server file system. | |
result | Optional | Specifies a name for the structure in which cfftp stores the returnValue variable. If set, this value replaces cfftp as the prefix to use when accessing returnVariable. For more information, see Usage. | |
server | Required if FTP connection is not cached | FTP server to which to connect; for example, ftp.myserver.com. | |
systemType | Optional | Possible values for the attribute are:
| |
timeout | Optional | 30 seconds | The length of time, in seconds, that ColdFusion waits for a response from the FTP server.Used with action = "open" for a cached connection. |
transferMode | Optional | auto |
|
username | Required if connection is not cached | User name to pass in the FTP operation. |
ram:///filepath |
cfftp action | Value of cfftp.returnValue |
getCurrentDir | String. Current directory. |
getCurrentURL | String. Current URL. |
existsDir | yes or no. |
existsFile | yes or no. |
exists | yes or no. |
<p>Open a connection
<cfftp connection = "myConnection"
username = "myUserName"
password = "myUserName@allaire.com"
server = "ftp.allaire.com"
action = "open"
stopOnError = "Yes">
<p>Did it succeed? <cfoutput>#cfftp.succeeded#</cfoutput>
<cfftp connection = "myConnection"
action = "LISTDIR"
stopOnError = "Yes"
name = "ListDirs"
directory = "/">
<p>FTP Directory Listing:<br>
<cftable query = "ListDirs" HTMLTable = "Yes" colHeaders = "Yes">
<cfcol header = "<b>Name</b>" text = "#name#">
<cfcol header = "<b>Path</b>" text = "#path#">
<cfcol header = "<b>URL</b>" text = "#url#">
<cfcol header = "<b>Length</b>" text = "#length#">
<cfcol header = "<b>LastModified</b>"
text = "#DateFormat(lastmodified)#">
<cfcol header = "<b>IsDirectory</b>" text = "#isdirectory#">
</cftable>
<p>Move Image File to Remote Server:<br></p>
<!--- The image will be put into the root directory of the FTP server unless
otherwise noted, i.e., remoteFile = "somewhere_put.jpg" vs remoteFile = "/support/somewhere_put.jpg"
--->
<cfftp
connection = "myConnection"
action = "putFile"
name = "uploadFile"
transferMode = "binary"
localFile = "C:\files\upload\somewhere.jpg"
remoteFile = "somewhere_put.jpg">
<p>Did it succeed? <cfoutput>#cfftp.succeeded#</cfoutput>
<p>Close the connection:
<cfftp connection = "myConnection"
action = "close"
stopOnError = "Yes">
<p>Did it succeed? <cfoutput>#cfftp.succeeded#</cfoutput>