Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Loop over cfftp listdir output??

Guest
Apr 14, 2011 Apr 14, 2011

I am trying to loop over the info in our FTP directory using:

<cfftp action="listdir" username="commmast" password="H57Jvc21" server="ftp2.idaho.gov" directory="commuser" name="DirList">

<cfdump var="#DirList#">

If I do a dump, I see all the files, and other info I want, but if I do a:

<cfloop query="#DirList#">

#name#

</cfloop>

I'm getting:

Complex object types cannot be converted to simple values.

Why would this be?

567
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 14, 2011 Apr 14, 2011

SteveG144 wrote:

<cfloop query="#DirList#">

...

Complex object types cannot be converted to simple values.

Why would this be?

Because you are NOT supposed to put # signs around the query name in the <cfloop...> tag.

I.E. your code should be

<cfloop query="DirList">


In your code, ColdFusion is trying to resolve the variable "DirList" to derive a string to be used as the name of the query to loop over.  A record set (a complex data type) can not be made into a string (a simple data type).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 14, 2011 Apr 14, 2011
LATEST

Wow its been TOO LONG since I worked with CF............

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources