3 Replies Latest reply on Oct 1, 2012 8:49 AM by philmodjunk

    Inserting file reference and save file



      Inserting file reference and save file


           I am making a function to my FileMaker application. This function requres to open a file from users` USB Flash Drives and save the file to the database. I have created folders based on Category > Sub-Category.

           Here are the steps:

           1. FileMaker links a file and display on a FileObject viewer (Done!)

           2. I need to setup two fields which show the file extension and the size of file automatically.

           3. I need a button which saves the file into a new location. 
                     For example:   FileMakers will save the file based on filemac:/Category/SubCategory                     
                                                The file name will be the 'title', one of the field in the record

           I need help for step two and three. It will be very thanksful if anyone can solve my problem.


        • 1. Re: Inserting file reference and save file

               Exactly how are you doing step 1? Never heard of a FileObject viewer. Do you mean a web viewer or are you using a container field?

               What kind of files are you working with? The only files that I know of where you can get a file size are image files. Other file types may require a plug in before you can get the file size.

               3) If you have the file path to the file, you can use it to insert a file into a container field. You can then use export field contents to export a copy to a new location, effectively moving the file from one location to another. (And export field contents can be used to delete files as well as to export copies.)

          • 2. Re: Inserting file reference and save file

                 For example: when I click the 'Export File' button, it will save the file to the decided direction.

                 The direction should be:  [current drive] / [Category] / [SubCategory] / [the file name of the inserted file]

            • 3. Re: Inserting file reference and save file

                        it will save the file to the decided direction

                   Who "decides"? the script or the user who clicked the button?

                   The box above these buttons is a container field named "File", BTW.

                   If the image in Picture was originally inserted with the Insert Picture menu option (Or scripted equivalent) AND the "store a reference" option was specified, then there is a calculation you can use to extract the pixel dimensions of the image  (such as 2000 x 5000 ). If the Store a Reference option was not used, Length( File ) will return the size of the image.

                   With the layout that you show, do you have File Path correctly showing the current location of the file or will this be used to specify the destination to which you intend to export the file in the container field?