5 Replies Latest reply on Oct 31, 2007 2:25 AM by Mick Tomlinson

    File type display

    Mick Tomlinson Level 1
      Is it possible in ADDT during a file upload that the file type can be collected into a database field? Or at least its extension, if not the actual mime type.

      If ADDT can check the file extension before upload, surely this is possible?
      But perhaps the code would be difficult (I am a php simpleton).

      Many thanks
      Mick
        • 1. Re: File type display
          Günter Schenk Level 4
          Hi Mick,

          checking the file type with PHP is, technically speaking, nothing else than examining the complete file name (that´s stored in your table) and extracting the stuff that´s following the very last dot (.) within the string.

          Another very easy alternative can be used when all your files provide a "3 chars suffix" like "jpg", "pdf", "gif" or whatever -- in this case you´d just have to use this snippet:

          substr($queryname['column_name'], -3)

          to retrieve the last 3 chars of the filename that´s stored in a database column

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: File type display
            Mick Tomlinson Level 1
            Thank you so much!
            • 3. Re: File type display
              Mick Tomlinson Level 1
              Dear Günter

              Is it possible to use substr in the same way on the following:
              {rsFiles.file_name}
              so that the extension can be input into a database field? In other words, not just echoed.

              Thanks
              Mick
              • 4. Re: File type display
                Günter Schenk Level 4
                Hi Mick,

                ------
                Is it possible to use substr in the same way on the following:
                {rsFiles.file_name}
                ------

                there *might* possibly be a way to apply some sort of pre-processing on that "dynamic data" in order to split the file name and put the segments in two separate columns (guess this is what you want ?), but right out the box this neither supported nor documented.

                Why do you need this ?

                Cheers,
                Günter Schenk
                Adobe Community Expert, Dreamweaver
                • 5. Re: File type display
                  Mick Tomlinson Level 1
                  It's for a file manager. I was hoping to be able to sort a list of files by type, which would be easy if the type name was in a field of its own. In other words it had been entered into a separate field on upload of the file.

                  It's not essential however!