Applies to: Syncplify.me Server! Version(s): 4.1.6 - 5.x
As of version 4.1.6, Syncplify.me Server! added 2 new functions to the VFS object for you to use inside your event-handling scripts (requires the Ultimate edition of the software).
Say, for example, that you have an encrypted VFS, like a VFS of type DiskAES256.
As you surely already know, when you use an encrypted VFS all files that users upload into such VFS will be encrypted at-rest (on your server’s hard drive).
But what if you need to copy/move files – as they are uploaded – out of the VFS for further processing? Obviously, if you use the FileCopy/FileMove
functions the file will be copied/moved “as is”, in its encrypted form, and other software products won’t be able to read and process it.
Therefore a method to export files from an encrypted VFS to a different and unencrypted location was needed. To do so, you can use the new function ExportFile which is part of the VFS object namespace. When using functions in this namespace we recommend to always verify that VFS is not nil, as this object is not always defined in every execution context. See the script below for example:
begin if (VFS <> nil) then begin VFS.ExportFile(VirtualObjectName, 'C:\DestDir\'+ExtractFilename(Objectname), false); end; end.
Then you can configure your Syncplify.me Server! to run the above script every time a file is uploaded. When the script runs, the uploaded file will be copied from the encrypted VFS out to C:\DestDir\ and it will be unencrypted in the process. The last parameter (in this example set to “false”) tells the scripting framework whether you want to delete the original file from inside the VFS after the copy (essentially making the operation a “move”) or not. So our script, with that parameter set to false, effectively copies the file out of the VFS instead of moving it.