4 Replies Latest reply on Sep 10, 2008 10:21 AM by (John_Groh)

    Rename File on Insert?

      Hi all,

      Is there a way to rename a file to be inserted into the database like this"

      flash/images/image.jpg

      ?

      I have an upload file behavior on a form and it saves the file correctly into the right folder (flash/images). But when inserting a new image using the insert form, it only inputs in the name of the file (image.jpg). Is there a way to add the "flash/image/" before the name of the file in the database? I cant seem to figure it out.

      Thanks
      John
        • 1. Re: Rename File on Insert?
          Günter Schenk Level 4
          Hi John,

          although you could possibly do this by defining an advanced "renaming" pattern, things like "flash/image/filename" are not valid names anyway, as file names can´t have slashes.

          What purpose would that be for ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Rename File on Insert?
            Level 1
            Hi Gunter,

            The name "flash/images/filename.jpg" is the path to the image that I want stored in the database. When using the upload file sb, it correctly saves the file into the flash>images folder but in the database, all that shows up is the name of the file (for example, "myimage1.jpg" rather than the full path to the image in the images folder inside the flash folder (hope this makes sense).

            Because I am then exporting an XML file into Flash, I need to have the correct path stored in the database, but I dont know how to do this using the insert sb, then export XML, then link to that export XML file in my Flash file. Any ideas?
            • 3. Re: Rename File on Insert?
              Günter Schenk Level 4
              Hi John,

              in this case I´d rather not use ADDT´s XML Export behaviour, as it´s a little inflexible at times, and there´s no way to add a static "flash/image/" value preceding the dynamic column value which represents the file name.

              Such advanced things can rather easily be done with some manual coding. Please have a look at Spry´s "Query to XML samples" and check the PHP example which says "Manual: This version loops over a query. Edit the Query and XML node names to match your needs": http://labs.adobe.com/technologies/spry/samples/utils/query2xml.html

              My suggestion is to have this script generate the following XML element:

              flash/images/

              ... as this would represent a fully-fledged image path which contains both a static element (flash/images/) as well as a dynamic element ($row_queryname['columnname'])

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Rename File on Insert?
                Level 1
                Hi Gunter,

                Thank you! I was on the right track...I was trying to do something similar to this with another script I found online. I just couldnt get it to work. Ill play around with this. Thanks again.

                John