Get directory path pointing to the correct folder?

204 Views Asked by At

I'm trying to create link for the file upload. I'm calling file upload function from .cfc file. The file should be uploaded in a different folder. Here is what I get if after this code is executed in component.cfc page:

<cfset thisPath = ExpandPath( "./" ) />

C:\\wwwroot\\myapp\\components\\

I need to go level back in myapp and open bug folder. Then in a bug folder I need to direct the path either to folder1/ documents or folder2/documents. That will depend on the form field, here is example:

<cfset folder = trim(form.type) EQ 1 "folder1" : "folder2">

The path should either point to:

C:\\wwwroot\\myapp\\bug\\folder1\\documents\\

or

C:\\wwwroot\\myapp\\bug\\folder2\\documents\\

I'm looking for a solution that will work even if I roll this code to a different server with the same directory structure. Is there a good way to achieve this in ColdFusion?

0

There are 0 best solutions below