5 Replies Latest reply on Jan 6, 2009 3:38 AM by Günter Schenk

    File or Image upload limit by condition ?

    niksveler Level 1
      Hello everybody !
      Happy new year!

      I have a problem!
      I want to give a limit for users who want upload files on server, for example - if I give choice for user in file upload form - to upload from 5 to 10 files only? The user choice - 7 files to upload total, and how I can by using some kind a condition check and redirect user back to upload form if != 7 and redirect to (for example) to list submitted files if == 7 ! how I can do that? Any Ideas? Just stuck already for few days, have no Idea ????

      Thanks.
        • 1. Re: File or Image upload limit by condition ?
          Günter Schenk Level 4
          Hi and happy new year to you too (and to all others of course ;-)

          are you talking about ADDT´s multiple image/file upload component, or is it about a single file upload ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: File or Image upload limit by condition ?
            niksveler Level 1
            Hi Gunter !
            I m think I will go to the single file upload (if it's less complicated :) )
            The problem, it's the gallery web and artist supposed to pay for each submitted image, for example 5 images - $20, plus each additional for $5, and I can't figure it out, with one way is better? to do this task?

            Nick.
            • 3. Re: File or Image upload limit by condition ?
              Günter Schenk Level 4
              Hi Nick,

              yeah, in your case I think the single file upload will be much easier to supervise.

              Off the top of my head I´d suggest considering this strategy:

              1. add two "int" colums to your ADDT "users" table, and name them e.g. "file_uploads_allowed" and "file_uploads_consumed"

              2. set the value of each user account´s "file_uploads_allowed" column to the desired value, e.g. 7

              3. the update form you´re talking about (the one with a single file upload instance) should contain two things:

              3.1. an AFTER trigger which contains a query that increments the current user´s (who´s identified by the Session Variable kt_login_id) "file_uploads_consumed" column by +1 -- this trigger needs to be placed after the file upload trigger in order to make sure it only executes when the file upload procedure was successful.

              3.2. an additional recordset with the following query:

              "SELECT file_uploads_allowed, file_uploads_consumed FROM users WHERE user_id" equals the Session Variable kt_login_id

              I guess you get the picture: if the number of both colums should equal, you could lock the file upload feature.

              Makes sense ?

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: File or Image upload limit by condition ?
                niksveler Level 1
                Hi Gunter !

                You just did proof one of my ideas, but I m was not sure about how to handle the database table, I was thinking to create kind a temporary table for holding the files value and used for the compare condition where the uploading starts. Any way , you are clear my mind now :) !
                I know where to go !

                Thank you very match !
                If you are around San Francisco, stop by in our Gallery !
                We will have a lots event's soon ! www.calmodern.com
                Nick.
                • 5. Re: File or Image upload limit by condition ?
                  Günter Schenk Level 4
                  Hi Nick,

                  -------
                  If you are around San Francisco, stop by in our Gallery !
                  -------

                  let´s see if I can get a flight from Germany soon :-) Love that website !

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver