Add file to Custom Property

Jeffrey Massung massung at gmail.com
Sat Mar 13 14:25:31 EST 2010


On Mar 13, 2010, at 1:17 PM, Bill Vlahos wrote:

> I want to add a file from disk to a custom property, encrypt it, and save it. Then I want to be able to extract the file from the custom property and open it in the appropriate application.
> 
> 
>   read from file lFileToRead until end
>   put base64Encode(lFileToRead) into lBinaryFile -- not sure if this is needed


lFileToRead is the name of the file, not the data that was read from the file. Use 'it' to access the data that was read from lFileToRead. 

And, as a side note given the first sentence of your email... base64 encoding is not a form of encryption, nor is it a type of compression. Base64 encoding is a means of taking binary data and turning it into something that can be sent via email, posted to a website, etc (read: no spaces, line feeds, nulls, etc).

If you want to actually encrypt the data, you should do that first before base64 encoding it (with the encrypt command). But, you should be aware that the encrypt command requires a password/key, which will also be needed to decrypt the data. While you may be able to encrypt it with the message box or via some other means, you'll need the password/key in a script somewhere to decrypt it... thereby nullifying any hope of secrecy for whatever the data happens to contain.

Jeff M.


More information about the use-livecode mailing list