5 Replies Latest reply on Sep 12, 2006 7:32 AM by Newsgroup_User

    Multiple Uploads

    Level 7
      I have a page where the user can update a page and upload 1 audio file and 2
      photos for a streaming radio show.

      I can use cffile to upload the 3 items, but how can I caputure just the file
      names for each using cffile.serverfile?

      I know that I can use cffile.serverfile in a single enviroment, but when 3
      unique items are being uploaded, would I have to write 3 cffiles uploads,
      followed by 3 updates queries so that each doesn't overwrite the previous
      cffile.serverfile?

      Is there a way to make them unique so I can first upload the 3 files and
      then insert them into a database?


        • 1. Re: Multiple Uploads
          Level 7
          With MX 7 or later you can. The cffile tag now has a 'result' parameter
          that you can use to name the structure for the file details.

          <cffile action="upload" result="fileOne" ...>
          <cffile action="upload" result="fileTwo" ...>
          <cffile action="upload" result="fileThree" ...>

          <cfdump var="#fileOne#">
          <cfdump var="#fileTwo#">
          <cfdump var="#fileThree#">

          Previous to MX 7 you would have to do what you described, upload the
          file and access the file structure. But you could copy the structure at
          this time for later processing.

          <cffile action="upload" ...>
          <cfset fileOne = duplicate(file)>

          <cffile action="upload" ...>
          <cfset fileTwo = duplicate(file)>

          <cffile action="upload" ...>
          <cfset fileThree = duplicate(file)>

          <cfdump var="#fileOne#">
          <cfdump var="#fileTwo#">
          <cfdump var="#fileThree#">
          • 2. Re: Multiple Uploads
            Level 7
            Thanks for the info...

            So if I wanted to insert the cffile.server (or just the file name without a
            path) how can I do it using the results attribute?


            • 3. Re: Multiple Uploads
              Level 7
              Thanks for the info...

              So if I wanted to insert the cffile.serverfile (or just the file name
              without a path) how can I do it using the results attribute?


              • 4. Re: Multiple Uploads
                Level 7
                Thanks for the info...

                So if I wanted to insert the cffile.serverfile (or just the file name
                without a path) how can I do it using the results attribute?

                The results attribute renames the file structure returned by a
                <cffile...> operation.

                <cffile action="upload" result="anExample" ...>

                <cfoutput>#anExample.serverFile#</cfoutput>

                All the status parameters that are available in the original file
                structure are also available in the anExample structure.
                • 5. Re: Multiple Uploads
                  Level 7
                  Thanks a ton!