iosImage to Base64 Encode JSON

Hi there,
I have now tried most any method to get my iOS picture into a Base64 Encoded Text variable for me to send it as JSON item to MySQL, but the only thing that seems to function, is this from iOS (Documentation):

Var hashMB As Xojo.Core.MemoryBlock = rs.IdxField©.NativeValue

Var joiner() As Text
For i As Integer = 0 To hashMB.Size - 1
Var b As UInt8 = hashMB.UInt8Value(i)
joiner.AddRow(b.ToHex(2))
Next
Var Hex As Text = Text.Join(joiner, “”)

d.Value(rs.Field©.Name) = Hex

But the reverse on my Xojo Cloud is horrendous slow, so I think I need to use Base64, but I simply can’t the the syntax correct according to the IDE. I store it fine on the iOS Local SQLite DB, but I need the simple code to convert the Image to Base64 and the Code on the server to Decode it back into Image-format

I tried the Xojo Example project Base64, but it doesn’t function with MemoryBlock as it does on Text fields. And I can’t see tom get the MemoryBlock into a Text variable.
I also tried Xojo.Core.TextEncoding.UTF8.ConvertDataToText(mb) but I get an RunTime Error (charakter can’t be converted)

So If any could assist in getting the correct code I would be SOOO grateful:

iOS:
Var mb_ToEncode As Xojo.Core.MemoryBlock = rs.IdxField©.NativeValue




d.Value(rs.Field©.Name) = [Encoded TextField]

Xojo Cloud:
Var txt_ToDecode as Text = ChangedField.Value



rs.Column(“Picture”).Value = mb

Why aren’t you using decodehex on your web project?

Excellent question. I just assumed to use the corresponding code from documentation. I’ll get on it right away