tags:

views:

80

answers:

3

I'm using CF 7 and this code is not returning any files:

<cfset fileLocation = "\\server\uploader\pass-fail">
<cfdirectory 
  action = "list"
  directory = fileLocation
  name = "pass_fail_files"
  >

     <cfdump var="#pass_fail_files#" expand="yes"   label="files in pass-fail" >

     <cfoutput>#pass_fail_files.name#</cfoutput>
     <cfoutput>#pass_fail_files.directory#</cfoutput>
     <cfoutput>#pass_fail_files.size#</cfoutput>
     <cfoutput>#pass_fail_files.type#</cfoutput>
     <cfoutput>#pass_fail_files.dateLastModified#</cfoutput>
     <cfoutput>#pass_fail_files.attributes#</cfoutput>
     <cfoutput>#pass_fail_files.mode# </cfoutput>

I have checked to make sure that the directory indeed has several text files. But when I run the code, all I get is:

alt text

What am I doing wrong?

+2  A: 

My first question would be, does the ColdFusion Service User have read access on folder?

Actually, I think your code should be

<cfdirectory action = "list" directory = "#fileLocation#" name = "pass_fail_files" >

I think right now, you're telling it to look in a directory named "fileLocation".

iKnowKungFoo
Yes, it has all permissions.
Anthony
No, since fileLocation is _not_ in quotes, it is evaluated as a variable.
Adam Tuttle
You've just beaten me to it Adam :-) See my answer below...
Marcos Placona
Your answer is above now, if sorted by votes.
Al Everett
A: 

Assuming you've done all the latest CF7 updates/patches/hotfixes..

Jas Panesar
+6  A: 

I've just tried this:

<cfset fileLocation = "\\192.168.8.20\websites">
<cfdirectory 
  action = "list"
  directory = "#fileLocation#"
  name = "pass_fail_files"
  >
<cfdump var="#pass_fail_files#" expand="yes"   label="files in pass-fail" >

On CF7, CF8 and Railo, and works everytime.

Notice I updated your code so it uses the directory attribute as directory = "#fileLocation#" as opposed to directory = fileLocation.

Trying your code, I never got results, but didn't get errors either. Changing it to use double-quotes and hashes did the trick, as it stopped using it as a variable.

Hope it helps you.

Marcos Placona
Thanks, it worked :)
Anthony