3 Replies Latest reply on Apr 7, 2015 3:36 PM by philmodjunk

    external container naming issues

    gethappy@happypc.com

      Title

      external container naming issues

      Post

      We have records with an external container, and sometimes the user will want to insert a new file into the container in place of the existing container file yet keep the same file name.  By design, Filemaker changes the file name to add an incremental suffix, so in the external container’s directory we see the original file and a new file with a suffix instead of deleting or overriding the original file.   so now we have two files, named originalimage.jpg and originalimage_1.jpg.  I understand WHY FileMaker does this ... it is sort of a fail safe to avoid a situation where a user accidentally uploads two images with the same name into two different records but since they technically different files, filemaker is trying to protect the original file from deletion. Problem is … in our case, we want to turn off this fail safe.  We have other systems in place that deal with duplicate file names, so if the user wants to upload a file with an identical name, we want to delete or overwrite the original file and not create a second file.

      A good example is an image, where the user inserts an image into the container, then outside of FileMaker they edit that image so it is now a different file size with different attibutes.  Then the user inserts the newly edited file (but same filename) into the same record's container.   Currently the end result is that we end up with two files in the directory (one with a _1 suffix on the name), but we only want the new file to exist.

      what I was originally thinking of doing was to first remove the existing (original) container (using set field to be "", or clear field, or cut) along with a goto field OR commit record and then inserting the new file.  but for some odd reason, this doesn’t seem to work.  The file names keep incrementing.

      How can I clear the existing container data before I insert a new file into the container?

      Thank you!