CFdirectory tag doesnot display files in a directory even if the files appear in the source folder

450 Views Asked by At

I am trying to read a spreadsheet from a shared location folder. using

<cfparam name="xlfilepath" type="string" default="\\file02\OP\!FILE STRUCTURES and FORMS\Agreements\Tracker.xls" />
<cfspreadsheet action="read" src="#xlfilepath#" excludeHeaderRow="true" query="MsaDataSheet1" sheet="1" />

"OP" is the shared folder.

I got "java.io.FileNotFoundException:".Then I try to display the directory listing using cfdirectory tag.

<cfdirectory action="list" directory="\\file02\OP\" recurse="false" name="myList">
<cfdump var="#myList#"><cfabort>

I see that there is no list displayed although there are subdirectories and folders and files in the OP directory.

Does the folder needs any specific permissions to be read by any application or any other mapping required?

1

There are 1 best solutions below

3
Kannan.P On

Here I will explain by using cf16. The ColdFusion runs in Windows as a service and if we look into all the services of the machine we will find as follow:

enter image description here

Here, you can notice that for ColdFusion service the LogOnAs value is "LocalSyatem". It means ColdFusion service is started as "LocalSystem" login and this login doesn't have enough permission to do any operation on network. So, in order to make the required file operation in the Shared Directory we will have to change the LogOnAs value for ColdFusion service. Please follow the below step to enable it,

  1. Right Click on the ColdFusion Service then click on "properties".
  2. Click on "Log On" tab. Then you will see a screen like this
  3. Select "This account" radio button .Then click on "Browse" button and select the user by which you want to start the service. You should choose the user who have sufficient permission to create file on the shared directory and also have required permission in local.

enter image description here

But we have to restart the ColdFusion Service for the changes to effect.

Let me know if this work to you or not. Or correct me if I'm wrong understood.