3 Replies Latest reply on Aug 6, 2006 12:32 AM by Abinidi

    Trimming the file name fromt the path

    Level 7
      I am using cffile to upload an image to the database. I need to figure out a
      way to only store the filename in the database verses the path. How can I do
      this?

      <cffile action="upload" accept="image/gif, image/jpeg, image/jpg, image/png,
      image/psd" destination="E:\webs\website.com\main\clients\logos"
      filefield="form.logo" nameconflict="makeunique">


      --
      Wally Kolcz
      Developer / Support


        • 1. Re: Trimming the file name fromt the path
          dempster Level 1
          CFFILE returns a set of variables with information about the upload:

          Directory: #File.ServerDirectory#
          Server File Name: #File.ServerFile#
          File Size: #File.FileSize#
          Time Created: #File.TimeCreated#
          Time Last Modified: #File.TimeLastModified#

          ServerFile is the one you want.
          • 2. Re: Trimming the file name fromt the path
            Level 7
            To be able to use any of those, you would want to enter the cffile prior to
            the cfquery INSERT, correct? Would you then set the #File.ServerFile# to a
            variable so it can be inserted?

            "dempster" <webforumsuser@macromedia.com> wrote in message
            news:eb2e4k$13v$1@forums.macromedia.com...
            > CFFILE returns a set of variables with information about the upload:
            >
            > Directory: #File.ServerDirectory#
            > Server File Name: #File.ServerFile#
            > File Size: #File.FileSize#
            > Time Created: #File.TimeCreated#
            > Time Last Modified: #File.TimeLastModified#
            >
            > ServerFile is the one you want.
            >
            >


            • 3. Re: Trimming the file name fromt the path
              Abinidi Level 1
              Yes.
              Do your uploading using CFFILE. Once the code completes that section, it will give your variables that you can use in the code .
              Now do your cfquery and use the variables that CFFILE created.