Professional Web Applications Themes

Problem with cfdirectory - Coldfusion - Getting Started

Hello all, I am new to Coldfusion. I am using this peice of code to get the number of files <cfdirectory directory = "/MyDir/images" action="list" name = "MyTest" > <cfoutput>*******Number of Files = #MyTest.RecordCount#</cfoutput> I always get 0 as the number of files inspite of my images directory having 12 files . Why is that? I am usuing ColDFusion MX 6.1 with Apache on Red hat Linux AS 3.0 Please help ! Thanks in advance...

  1. #1

    Default Problem with cfdirectory

    Hello all,
    I am new to Coldfusion.
    I am using this peice of code to get the number of files

    <cfdirectory
    directory = "/MyDir/images"
    action="list"
    name = "MyTest"
    >
    <cfoutput>*******Number of Files = #MyTest.RecordCount#</cfoutput>

    I always get 0 as the number of files inspite of my images directory having 12
    files .
    Why is that?
    I am usuing ColDFusion MX 6.1 with Apache on Red hat Linux AS 3.0 Please help
    !

    Thanks in advance

    qgh Guest

  2. #2

    Default Re: Problem with cfdirectory

    Specify the full path in the directory attribute, something like this:



    <cfdirectory directory = "d:/inetpub/wwwroot/MyDir/images" action="list" name = "MyTest">
    jdeline Guest

  3. #3

    Default Re: Problem with cfdirectory

    qgh,

    Maybe this is a permissions problem. Does the cold fusion account have permissions to the /myDir/images directory?


    mxstu Guest

  4. #4

    Default Re: Problem with cfdirectory

    I given the path from my Apache webroot i.e /var/www/html

    Thanks for the reply.
    MyDir is a dir under webroot i.e /var/www/html/MyDir

    The Webserver would not understand any path other than from the webroot i.e My
    specifying /var/www/html/MyDir does not help.

    Any other suggestions?

    Has anyone tried this ColdFusion code on Red Hat Linux?


    qgh Guest

  5. #5

    Default Re: Problem with cfdirectory

    Thanks for replying.
    ColdFusion is running as user nobody (the deafult user with which it installs)

    Images Directory has these permissions
    drwxrwxr-x 2 nobody nobody 4096 Jul 13 16:33 images

    And its parent directory i.e MyDir has these permissions
    drwxrwxr-x 18 nobody nobody 4096 Jul 13 16:46 MyDir

    Any ideas?


    qgh Guest

  6. #6

    Default Re: Problem with cfdirectory

    For CFDIRECTORY you must use an absolute path (not a URL). For example, in
    windows an absolute path might be: c:\apache\web\dev\html\myDirec . Just use
    the Linux equivalent of an absolute path.

    Did you also check the permissions? Does the cold fusion account have
    permissions for that directory?

    mxstu Guest

  7. #7

    Default Re: Problem with cfdirectory

    Thank you very much.
    Specifying the whole path solved the problem.
    I guess Apache is not in picture while the CF code is being executed - hence
    there was no reason to consider the web root.

    Thanks anyways

    qgh Guest

Similar Threads

  1. cfdirectory and Flash
    By Rowan in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: July 19th, 02:58 PM
  2. CFDIRECTORY - RECURSIVE LOOK IN
    By maquejp in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: May 30th, 07:34 AM
  3. How do I use CFtree and CFdirectory?
    By fvanstaveren in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: May 5th, 04:38 PM
  4. sorting in <cfdirectory>
    By joonstar in forum Macromedia ColdFusion
    Replies: 1
    Last Post: May 3rd, 10:59 AM
  5. CFC , CFDIRECTORY into Array
    By stebennettsjb in forum Coldfusion - Getting Started
    Replies: 3
    Last Post: March 9th, 12:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139