On Apr 13, 2006, at 5:57 PM, Charles Ross wrote:
Norman,
You are correct that I want to store the actual file. Forgive my
newbie status on this, but I'm afraid that I don't quite know
everything I need to given your instructions. For instance, you say
to base 64 encode, but the EncodeBase64 function expects a string
as the first parameter. While some of the files to be stored are
text files that can easily be translated to a string, most are PDF
files. How to I move from the binary representation of the PDF to a
string that can be used by EncodeBase64?
A REALbasic string can hold anything, including binary data
Since the files are PDF, I'm assuming that I need to use
FolderItem.OpenAsBinaryFile to get the contents of the file.
Yes. Use that for ALL your files
If I can overcome that, then I think my code would look something
like this:
dim newFile as new FolderItem
newFile = App.AppSupportFolder.Child(newName)
dim bis as new BinaryStrem = newFile.OpenAsBinaryFile
// Somehow get this BinaryStream to a string called strRep
dim rec as new DatabaseRecord
rec.Field("File") = EncodeBase64(strRep)
App.Database.InsertRecord(App.Database.Files, rec)
Am I on the right track?
Thanks,
Chuck
You bet !
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>