Jump to content

Marking a container as "Compressed" as Insert File can


DanShockley
 Share

This topic is 2604 days old. Please don't post here. Open a new topic instead.

Recommended Posts

There is a very useful option when you run the script step "Insert File" - you can choose the "Compress" checkbox to store the file compressed. Helpfully, FileMaker shows the icon and filename of the file in that container without any indication that it is compressed, but there is a lot less data being stored in the database (or external on the server ) and there is less data to transfer over a WAN or otherwise slow network. If you then choose to "Export Field Contents" of that container field, FileMaker silently decompresses that data to export the original file. Having looked at what is stored, it seems that silent compression is the gzip format. 
 
Let's say, however, that you want to Base64 encode that container to transfer it via something other than a direct FileMaker import/export or Set. So, you Base64 Encode that container into another field named "Container_asBase64." Then, you transfer that base64 data via a script or an http transfer (perhaps using RESTfm by Goya, for example). You then run that base64 through FileMaker's Base64Decode and the correct file name. You set a container field named "DestinationContainer" to the result. You see the file icon and file name, and it takes up the same reduced space. Then, you Export Field Contents on "DestinationContainer" and save with the original file name to your Desktop. If you try to open that file, it does not work. If, however, you then edit the file name to add ".gz" (gzipped file extension) and then try to open it, your operating system decompresses it and the resulting file can then be opened. 
 
You can skip a step by picking the file name with the ".gz" appended when you Base64Decode, but that still means the OS needs to decompress the exported field contents, instead of FileMaker automatically doing that during the export. 
 
The problem is that if your OS has no way to decompress the gzipped file, you are stuck. As an obvious example, iOS using FileMaker Go cannot do this within FileMaker. If the whole point was to have a FileMaker Go solution do an http request that gets base64-encoded data, converts it back into container data, and then exports it in order to transfer another FileMaker database, I don't know how to decompress that gzipped file. 
 
Thoughts? Obviously, if this isn't possible, it is possible to do this by transferring via a direct FileMaker connection, but it would really be helpful to be able to flip that bit or whatever FileMaker's "Insert File" script step does to mark the container as "compressed" and have alternate transfer methods take advantage of this.  
  • Like 1
Link to comment
Share on other sites

This topic is 2604 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.