FMP 10 on MacintoshReferenced or Embedded documents in container field?Title: Get file name and file size from a container field
Stop Embedding Documents in Your Database!
One trick would be to use the filepath stored in a "by reference" container field to temporarily embed a copy of the file in a global container field. Then the Length function can be used to return the size of that file in bytes.
Thank you for your help. It sounds a little complex. I will need to study this more and be careful not to let the containers grow the database too large.
What I describe shouldn't make a significant change to the size of your file.
What I describe would only add a single global container field that embeds only one file at a time as it has global storage specified. In a networked database, even that single embedded file will disappear from the global field when the file is closed.
The script would look like this:
Set Variable [$Path ; "file:" & Get ( TemporaryPath ) & "TempFile.jpg"]
export Field Contents [YourTable::Containerfield ; $Path ]
Insert File [Insert ; Globals::GlobalContainerField ; $Path ]
Set Field [YourTable::FileSize ; Length ( Globals::GlobalContainerField ) ]
Note "Insert" will not appear in your script step unless you are using FileMaker 12. The example script assumes that all fields are .jpg files. If the files are of varying file extensions, you can use this expression in place of "TempFile.jpg" to use the file's original file name--including the correct extension:
//This should work for all insertion and storage methods except "insert Object":
Let ( [T = GetAsText ( GetValue ( YourTable::containerField ; ValueCount ( YourTable::containerField ) ) ) ;
L = Length ( T )];
Right ( T ; L - Position ( T ; "/" ; L ; -1 ) )