Hi Ray,
Just tried it:
<cfset thisDir = directoryList(directory,false,"query")>
Now I get an error:
Complex object types cannot be converted to simple values.
The expression has requested a variable or an intermediate expression
result as a simple value. However, the result cannot be converted to a
simple value. Simple values are strings, numbers, boolean values, and
date/time values. Queries, arrays, and COM objects are examples of complex
values.
The most likely cause of the error is that you tried to use a complex value
as a simple one. For example, you tried to use a query variable in a cfif
tag.
The error occurred in
E:/domains/live/ce/wwwroot/admin/fileManager/cffm.cfc: line 419
Called from E:/domains/live/ce/wwwroot/admin/fileManager/cffm.cfm: line 597
Called from E:/domains/live/ce/wwwroot/admin/fileManager/cffm.cfm: line 1
417 : <cfif type is "dir">
418 : <!--- go deep! --->
419 : <cfset directoryList(directory & path & name,true,dirInfo)>
420 : </cfif>
421 : </cfloop>
The whole function that's causing the error is here:
<cffunction access="public" name="directoryList" output="true"
returnType="query" HINT="List the contents of a directory, optionally
recursing into subdirectories. This was implemented due to inconsistencies
between Coldfusion and Bluedragon.">
<cfargument name="directory" type="string" required="true">
<cfargument name="recurse" type="boolean" required="false" default="false">
<!--- temp vars --->
<!--- example: list = DirectoryList(dir,"","","true"); --->
<cfargument name="dirInfo" type="query" required="false">
<cfargument name="thisDir" type="query" required="false">
<cfset var path="">
<cfset var temp="">
<cfif not recurse>
<cfdirectory name="temp" directory="#directory#">
<cfreturn temp>
<cfelse>
<!--- We loop through until done recursing drive --->
<cfif not isDefined("dirInfo")>
<cfset dirInfo =
queryNew("attributes,datelastmodified,mode,name,size,type,directory,fullPath")>
</cfif>
<cfset thisDir = directoryList(directory,false,"query")>
<!---<cfdump var="#thisDir#">
<cfabort>--->
<cfif server.os.name contains "Windows">
<cfset path = "\">
<cfelse>
<cfset path = "/">
</cfif>
<cfloop query="thisDir">
<cfset queryAddRow(dirInfo)>
<cfset querySetCell(dirInfo,"attributes",attributes)>
<cfset querySetCell(dirInfo,"datelastmodified",datelastmodified)>
<cfset querySetCell(dirInfo,"mode",mode)>
<cfset querySetCell(dirInfo,"name",name)>
<cfset querySetCell(dirInfo,"size",size)>
<cfset querySetCell(dirInfo,"type",type)>
<cfset querySetCell(dirInfo,"directory",directory)>
<Cfset querySetCell(dirInfo,"fullPath",directory & path & name)>
<cfif type is "dir">
<!--- go deep! --->
<cfset directoryList(directory & path & name,true,dirInfo)>
</cfif>
</cfloop>
<cfreturn dirInfo>
</cfif>
</cffunction>
So I commented out:
<cfif type is "dir">
<!--- go deep! --->
<cfset directoryList(directory & path & name,true,dirInfo)>
</cfif>
Now it loads a few lines in the filemanager and then throws another error.
Won't bore you with that one too.
I think I will have to find a more up to date file manager for this client
:)
On 10 May 2013 12:18, Raymond Camden <[email protected]> wrote:
>
> In your cfdump, did you notice it said array? That's why you couldn't use
> the result as a query, it was an array.
>
> Did you check the docs?
>
>
> http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSce19a0e5a003e2edfa09972122fa66a2e8-7ffe.html
>
> Use the third argument to specify query and you should be fine.
>
>
>
> On Fri, May 10, 2013 at 6:06 AM, Edward Chanter <[email protected]>
> wrote:
>
> >
> > I'm using the CFM filemanager, it's an old piece of code but has worked
> > great until now. It's not supported any more and I've encountered a weird
> > problem after migrating from CF8 to CF10
> >
> > I'm getting an error after a directoryList()
> >
> > The code in question is: <cfset thisDir = directoryList(directory,false)>
> >
> > the error is:
> >
> > Attribute validation error for tag cfloop.
> > The value of the attribute query, which is currently thisDir, is invalid.
> >
> > But when I do a cfdump of the "thisDir" variable
> >
> > <cfset thisDir = directoryList(directory,false)>
> > <cfdump var="#thisDir#">
> > <cfabort>
> >
> > I get this:
> >
> > array
> > 1 ** correct path to file**\080909 - 2009 and the decisions you should
> take
> > part 2.doc
> > 2 ** correct path to file**\1.jpg
> > 3 ** correct path to file**\10 Challenges to Delivering a Unified
> Customer
> > Experience.pdf
> > 4 ** correct path to file**\10 Challenges to Delivering a Unified
> Customer
> > Experience1.pdf
> > 5 ** correct path to file**\10 Challenges to Delivering a Unified
> Customer
> > Experience2.pdf
> > ...
> > 3531 ** correct path to file**\~$mbership Summary - Padraig Drennan Sept
> > 2011.docx
> >
> > So it lists out the folder no problemo.
> >
> > What am I missing here? I've been staring at it so long I can't see the
> > wood from the trees. Is there an undocumented change or bug in CF10 that
> > relates to directoryList()? I tried googling the problem but couldn't
> find
> > anything.
> >
> > Any help would be most appreciated, I could find another file manager but
> > the CF-junkie in me is completely perplexed with this error and would
> > *love* to figure out what's happening.
> >
> > Thanks in advance :)
> >
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355706
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm