1 Reply Latest reply on Mar 25, 2009 11:06 AM by Günter Schenk

    Upload File To Existing Folders?

      I built a website that allows users to download files that are categorized. For example, "file1.pdf" is in "folder1" and "file2.pdf" is in "folder2" etc etc. I want to build an admin section to upload files to these folders based on the category the user selects. So, if I want to upload "file3.pdf" to "folder 1", it should be placed in that folder.

      I built a form with Nextensio and added the Upload file server behavior and it correctly lists the info in the database, but it does not save the uploaded file to the correct folder. Since there is a table in my database for "categories" and another for "files" (with a numeric foreign key, "idcat_file" that points to the id_cat of the "categories" table), when it uploads it only has a number to use from the insert transaction (the "idcat_file") and not the name of the folder ("folder1").

      Is there any way to upload a file like this to a specific folder that is not a number? These files and folders are used by others so I cant rename them.

        • 1. Re: Upload File To Existing Folders?
          Günter Schenk Level 4
          Hi John,

          what you might want to try, is patching the...


          ...line of the default "Trigger_FileUpload" function by implementing a standard PHP if/else condition in here (or outside this function) which checks whether the $_POST['idcat_file'] variable has the value 1 or 2 and accordingly sets a different folder path.

          I reckon that the possible procedure can be similar to what I described in my "Upload & Resize Image: setting the image width on the fly" tutorial: http://www.guenter-schenk.com/tutorials/tutorial.php?id=12

          Günter Schenk
          Adobe Community Expert, Dreamweaver