coldfusioncoldfusion-9cfdirectory

directoryExists evaluates to true and lists contents, but cannot find directory


I have some code that uploads a video to the server, but first checks that the upload directory exists and creates it if not.

<cfif not directoryExists(tempUploadVideoDIR)>
    <cfdirectory action="create" directory="#tempUploadVideoDIR#">
</cfif>

I wasn't finding the uploaded file, or the directory for that matter, in my file structure, so I ran a "list" function on the directory:

<cfdirectory name="getFiles" directory="#tempUploadVideoDIR#" action="list">
<cfdump var="#getFiles#">

and it lists the contents of the directory complete with my uploaded video.

I have checked the paths and they are all correct. I am definitely working on the correct server.

Where the heck is the directory?

localhost, CF9.02, IIS7.5


Solution

  • Consider using very important function in that matter- expandPath. Propably your path is relative and this function will make it absolute and working.