Hi,
I would like to open a FTP connection with CFMODULE and then do operations on
that connection.
[b]Here is my main : " Main.cfm "[/b]
<CFMODULE TEMPLATE="Module.cfm" Login="testLog" Password="testPw"
Connexion="Conn" Server="test.server.test">
<CFIF Retour>
Connection OPEN
<CFELSE>
Connection FAIL
</CFIF>
<CFFTP CONNECTION="Conn"
ACTION="listdir"
NAME="ListFiles"
DIRECTORY="upload"
STOPONERROR="Yes">
[b]Here is my MODULE : " Module.cfm "[/b]
<CFPARAM NAME="Attributes.Login" DEFAULT="">
<CFPARAM NAME="Attributes.Password" DEFAULT="">
<CFPARAM NAME="Attributes.Server" DEFAULT="">
<CFPARAM NAME="Attributes.Connexion" DEFAULT="">
<CFFTP ACTION="open"
USERNAME="#Attributes.Login#"
CONNECTION="#Attributes.Connexion#"
PASSWORD="#Attributes.Password#"
SERVER="#Attributes.Server#"
STOPONERROR="Yes">
<CFSET Caller.Retour = #CFFTP.SUCCEEDED#>
Issue:
"Invalid connection specified
The CONNECTION attribute you specified, 'Conn', is invalid or does not exist. "
Without the CFMODULE, it's OK.
CAN YOU HELP ME?
THANKS,
Bao
Adam Cameron - 31 Jul 2006 16:52 GMT
Yes.
This is a demonstration that CF isn't as typeless as it likes to make out.
If you param (or, in functions, VAR) the connection variable you'll be
using for a <cfftp> connection, you have to make sure it's the correct
type.
In CFMX 6, it's one of these:
createObject("java", "coldfusion.oroinc.net.ftp.FTPClient").init()
And in CFMX7 it's one of these:
createObject("java", "org.apache.commons.net.ftp.FTPClient").init()

Signature
Adam