Base64 encoding query

Hii everyone,
I am working on OTRS using HTTP REQUEST to create Ticket but I need to send attachment as well, which requires a parameter content which is base64 encoded

Sample is as follows

How do I get the content

Thanks and Regards,

You need to read the contents of the file and then convert them to base 64.
Here’s my workflow:

The line that does all the work is:
fileContentsBase64 = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(fileContents))

This converts the string I read from the file into a byte array and then converts that byte array to a base 64 string.

Before and after of text:

Hi @DanielMitchell

For some file the attachment is blank

For Such files with big data

What to do in that case

Thanks and Regards,