I am attempting to load files of markdown into a binary field. I am trying to use the texttobinary function to convert from text to binary - although it is raising an error that the data cannot be binary or numeric data. Is there a better way to import my text into a field within the db?
The result of a fileload( function is already binary. It’s the texttobinary( function that is complaining that its parameter isn’t text. So you just need to change
Is your Contents field really binary? If so, I am wondering why. Since Markdown is text, I would think you would want to use a Text field, not a Binary field. That way you will be able to do things like search and manipulate the Markdown text, which I assume is why you want to bring it into the database.
So what I think you want to do is make the Contents field a text field, and use this code:
Contents = binarytotext(fileload(importfilename))
Note that you don’t need to specify the encoding, because UTF8 is the default.