3 Replies Latest reply on Sep 11, 2008 8:29 AM by Newsgroup_User

    File Upload utility functionality

    Tony Soto
      I created a record keeping system where the user 3 uploads a files. When the user opens the system the second time to upload new files and perhaps only uploads 1 file the database records of the two other files are overwritten and not maintained. How do I correct this issue. The action page has been included.
        • 1. Re: File Upload utility functionality
          Level 7
          Tony Soto wrote:
          > I created a record keeping system where the user 3 uploads a files. When the
          > user opens the system the second time to upload new files and perhaps only
          > uploads 1 file the database records of the two other files are overwritten and
          > not maintained. How do I correct this issue. The action page has been included.
          ...
          > Attachm1='#Trim(Form.Attachment_1)#',
          > Attachm2='#Trim(Form.Attachment_2)#',
          > Attachm3='#Trim(Form.Attachment_3)#',
          ...

          This section of your update SQL is writing to all three attachment
          fields, even if the form fields are empty. The simplest solution is
          probably to make this section dynamic so that the Attachment fields are
          only updated if the form fields actually contain a valid value.
          • 2. Re: File Upload utility functionality
            Tony Soto Level 1
            Hi Ian,
            thanks for the response. How do I go about make the SQL statement dynamic?
            • 3. Re: File Upload utility functionality
              Level 7
              Tony Soto wrote:
              > Hi Ian,
              > thanks for the response. How do I go about make the SQL statement dynamic?

              You include conditional code inside the <cfquery...> block that
              dynamically builds the SQL. Which, from ColdFusion's point of view, is
              just text. No different then HTML, XML or any other text that
              ColdFusion is so good at dynamically building.

              Example:
              <cfquery...>
              ....
              <cfif this EQ that>
              thisField = 'thatValue'>
              </cfif>
              ...
              </cfquery>