开发者

can't list files in a directory

开发者 https://www.devze.com 2022-12-23 16:14 出处:网络
I\'m using CF 7 and this code is not returning any files: <cfset fileLocation = "\\\\server\\uploader\\pass-fail">

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=&q开发者_如何学Pythonuot;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 http://img682.imageshack.us/img682/5603/nofiles.png

What am I doing wrong?


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.


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".


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

0

精彩评论

暂无评论...
验证码 换一张
取 消