3 Replies Latest reply on Nov 20, 2012 7:36 AM by BKBK

    Getting Filename without Path in a CFC


      Hi All,


      I'm attempting to use a CFC/Event Gateway to get the filename of a file that has landed in a directory.


      What I'm getting instead is the full path with the filename.



      <cffunction name="onAdd" access="public" returntype="void" output="false">

      <cfargument name="CFEvent" type="struct" required="true">

      <cfset var data = arguments.CFEvent.data>

      <cfset var filename = arguments.CFEvent.data.filename>




      I know that the above code isn't complete, but I think it's what 'counts' here.

      The value that I'm getting back for the 'filename' variable is similar to this:




      What I want is just the filename  (filename.ext) part of that line.


      It appears that arguments.CFEvent.data.filename doesnt do it, and I've tried all kinds of combinations like  'filename', 'serverfile.filename', 'data.filename' and so on, but I must just be missing it.


      I found a workaround for what I'm trying to do with the CFC,  but it would be a lot easier if I just knew what I need to use in the code to just pull the filename of the file that was dropped into the directory.  (Using the DirectoryWatcher)


      If anyone can help out with how to do this,  it would be appreciated

      I've been at this for ten hours and feel like Captain Noob right about now.