6 Replies Latest reply on Nov 5, 2014 12:00 PM by Stephen Huston

    How to limit the file size of "insert file"?

    tntneo

      I am using a server with many connections.

      I could not find a good way to prevent users to upload large files.

      I use insert file in a secure container (external storage).

      This works great, but if many users start to upload very large files, my SSD could be filled rapidly.

       

      Any idea?

        • 1. Re: How to limit the file size of "insert file"?
          DavidZakary

          First option - teach your users what they can and cannot do. Not always possible but an informed user is a good thing.

          Second - take a look at plugins that can give you metadata about the file. It may be possible to test to see if the file exceeds the max you'd like to see uploaded.

           

          For the second version you may have to perform the upload, test it and then decide whether to keep it or not.

          1 of 1 people found this helpful
          • 2. Re: How to limit the file size of "insert file"?
            Stephen Huston

            If the file is an image file that you are wanting to limit in size, FileMaker can do that internally as the file is placed into the container field!

             

            Take a look at my sample file which does this at:

             

            http://www.dataxm.com/tips/downsample.html

             

            The downloadable sample includes a PDF with all of the Container Calculations and Scripting required to downsample the image as it is placed, so the original image is never part of the FM data — only the downsampled image goes into the data field.

             

            - Stephen

            • 3. Re: How to limit the file size of "insert file"?
              wimdecorte

              Create  your workflow so that the user inserts into a global container.  Then you can use the existing container Get() functions to inspect the file size.

              Global fields are local to the client's session so they are not sent to the server

               

              Based on what size you detect in the global you can then decide to refuse it, down-sample it before writing it to a non-global field in its proper record,...

              1 of 1 people found this helpful
              • 4. Re: How to limit the file size of "insert file"?
                Stephen Huston

                That's basically what my sample file does. Container Functions were introduced in FMP 12, but I find that only a very small number of developers have explored the power behind the Container Functions in 12 or 13, focusing instead on External Storage options to control file size. Using both really improves it for both storage and backup options.

                 

                These options allow the users to insert any size of image into the input-container-global and it ends up in the target field optimized to not larger than the size set by the developer. No image file optimization required of the users at all. After all, the users aren't going to do it themselves even if you tell them to.

                • 5. Re: How to limit the file size of "insert file"?
                  user19752

                  Sorry for commenting to already answered question, but the first option seems forgotten that field option has validation for limiting filesize 'Maximum number of kirobytes'.

                  • 6. Re: How to limit the file size of "insert file"?
                    Stephen Huston

                    Yes, but limiting the file size which the field accepts is far less user-friendly than accepting whatever they put in it while resizing it to what it should be. The resizing option makes it work for the user no matter how big the file is, without placing any burden on them to make it fit.