.... so... in theory, as long as you're connected to an ftp server, an
existsDir call should never return cfftp.succeeded=false correct? ...
I'm consistently getting these results from existsDir on CF 6.1
arguments.item = /ontap/_components/_cfc/test
<cfftp directory="#arguments.item#"
action="#arguments.type#"
connection="#connection()#"
stoponerror="#stopOnError()#">
cfftp.errorcode = 250
cfftp.errortext = 250 CWD command successful.
"/ontap/_components/_cfc" is current directory.
cfftp.returnvalue = NO
cfftp.succeeded = NO
So it looks like cfftp is telling me:
a) the directory doesn't exist
b) I can't tell you if the directory exists, because an error occurred
before I could figure that out
.... so obviously one of these is innaccurate...
It's strange tho, it seemed to be working and then just suddenly
stopped working and I can't figure out why. using stopOnError="true"
doesn't raise a ColdFusion exception, which seems to indicate that
cfftp.succeeded=NO is incorrect. I'm trying to use cfftp.succeeded to
return ftp errors to a listener object, but that won't work if it
returns an error when no error has occurred. :-/
Here is the complete method (sorry for the line-wrap):
<cffunction name="exists" returntype="boolean" access="public"
output="false" hint="indicates if a specified file or directory exists
on the ftp server">
<cfargument name="item" type="string" required="true"
hint="indicates the file or direcotry to find">
<cfargument name="type" type="string" required="false"
default=""
hint="file or dir - indicates the type of object to detect">
<cfset var cfftp = 0><cfset arguments.type = "exists" &
rereplacenocase(arguments.type,"^(file|dir).*$","\1")>
<cfset arguments.item = getRemotePath(arguments.item)>
<cfif not variables.isOpen><cfset open()></cfif>
<cfswitch expression="#arguments.type#">
<cfcase value="exists"><cfftp item="#arguments.item#"
action="#arguments.type#" connection="#connection()#"
stoponerror="#stopOnError()#"></cfcase>
<cfcase value="existsFile"><cfftp
remoteFile="#arguments.item#"
action="#arguments.type#" connection="#connection()#"
stoponerror="#stopOnError()#"></cfcase>
<cfcase value="existsDir"><cfftp
directory="#arguments.item#"
action="#arguments.type#" connection="#connection()#"
stoponerror="#stopOnError()#"></cfcase>
</cfswitch>
<cfif not cfftp.Succeeded>
<cfset cfftp.item = arguments.item>
<cfset broadcast("error",cfftp,arguments.type)>
</cfif>
<cfreturn cfftp.returnvalue>
</cffunction>
Any help greatly appreciated.
s. isaac dealey 954.522.6080
new epoch : isn't it time for a change?
add features without fixtures with
the onTap open source framework
http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207352
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54