5 Replies Latest reply on Mar 1, 2008 1:51 PM by (Adam_S_Bell)

    File Upload Question: Up to Multiple Folders?

    Level 1
      I don't think this is doable but Gunter knows the truth.

      Got a client I'm setting up a CMS for with a file upload feature. Works great but all uploads go to the same main folder. What the client wants is a way that when you upload a file for let's say a certain artist, it then uploads the file to that artist's subfolder within the main folder. I'm wondering if that's even possible in ADDT or if I need to hire a real PHP guy to do it. Any suggestions?
        • 1. Re: File Upload Question: Up to Multiple Folders?
          Günter Schenk Level 4
          Hi Adam,

          ----
          but Gunter knows the truth
          ----

          haha, let´s see if I´m any good :-)

          ----
          it then uploads the file to that artist's subfolder within the main folder
          ----

          Will that subfolder need to be created first, or does it already exist ? How will your customer choose the respective artist, from a menu in the very same page ? Guess I need some more information on the scenario...

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: File Upload Question: Up to Multiple Folders?
            Level 1
            Well, I suppose I could just create the new folders myself in DW and teach the client how to do it. It's pretty easy. Basically, here's how the client wants. You'd start with one main 'media' folder. Inside that folder would be individual folders for each artist on the record label. After that, a folder for each album as well as folders for press materials like headshots or press releases as PDF's. The idea is when the client goes to the Add File page, he'd first use a pulldown to select an artist, that in turn would populate another pulldown that would list all the albums. Then there would be a text area to type in the name of the track. Finally the file upload area to browse for a file on the HD and upload it. Currently all uploads go to the general 'media' folder with no subfolders.

            Make any sense? Here's what I got so far before the client made this request (and it works).

            http://www.basinstreetrecords.com/addfile.php
            • 3. Re: File Upload Question: Up to Multiple Folders?
              Günter Schenk Level 4
              Hi Adam,

              did you try with adding "dynamic data" values to the upload path you´re defining in the "set destination folder" ?

              quoting from the help file:

              ------
              In the Upload folder text box enter the folder on the server where you need to store your files or use the Browse button to select it from one of the site's folders.
              ------

              I´d set the "media" folder as statis value here, and...

              ------
              You can also use the Developer Toolbox Dynamic Data lightning icon to insert dynamic placeholders into the text box
              ------

              ... add e.g. the artist´s ID, which is derived from the pulldown menu´s *value*, as "dynamic data" to the file path.

              When looking at the generated "function Trigger_FileUpload" code, you should see a "setFolder" value like this:

              $uploadObj->setFolder("../../media/{artist_id}/");

              ...and that usually works, also because the respective "artist_id" subfolder will be created in case it´s missing

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: File Upload Question: Up to Multiple Folders?
                Level 1
                I tried that and got this message:

                KT_DynamicData:
                Column artist_id is not part of the current transaction.

                Realized it was artistID instead of artist_id but it didn't really matter. Still getting the same error.
                • 5. Re: File Upload Question: Up to Multiple Folders?
                  Level 1
                  OK, it's working. I just changed the name from artist_id to filenames_artistid from the rsDownloads recordset and now it works. However, if I use a table row name from another recordset it gives me that KT_DynamicData error. Which stinks because right now it's writing folder names as numbers instead of as actual names. Not a big deal to me but the client might not go for it.