Skip to main content
Inspiring
June 25, 2008
Answered

Upload issues

  • June 25, 2008
  • 1 reply
  • 338 views
Okay this is driving me nuts. I haven't had to do file uploads (using cffile) in several years that I have forgotten how I accomplished this before.

Currently I have a form in a subfolder called "fails" which is directly under my root (wwwroot/fails). All I want to do is send any files uploaded to a subfolder called "data" (wwwroot/fails/data). I know I need to set the path in the destination field, but I do not want to hard code the actual path (c:\cfusion8\...). I remember there being a variable that would show me the relative path of a file, but I forgot was that was called (I thought it was a CGI variable but none of them worked).

Any help will be appreciated.
    This topic has been closed for replies.
    Correct answer Newsgroup_User
    Not variables -- functions.

    This now varies by CF version. For the latest and greatest CF 8 I now
    use this (Just wrote this a minute ago).

    #getDirectoryFromPath(getCurrentTemplatePath())#

    Check the system functions in your documentation if you have an older CF
    server.

    1 reply

    Newsgroup_UserCorrect answer
    Inspiring
    June 25, 2008
    Not variables -- functions.

    This now varies by CF version. For the latest and greatest CF 8 I now
    use this (Just wrote this a minute ago).

    #getDirectoryFromPath(getCurrentTemplatePath())#

    Check the system functions in your documentation if you have an older CF
    server.

    spacehogAuthor
    Inspiring
    June 25, 2008
    Just found it in my CFWACK book. Similar to what Ian said. Here is another slight variation:

    #getDirectoryFromPath(ExpandPath("*.*"))#