Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / July 2006



Tip: Looking for answers? Try searching our database.

CFFTP WITH CFMODULE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GEnjikun - 31 Jul 2006 15:32 GMT
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.