Error during Converting image path to base64 string can anyone solve this issue ? Unable to get base64 string

I’m calling rest API from ui path API accepts base64 string as input so I’m converting through c# code but I’m receiving null empty data in variable.

Here. Is my code

byte[] imageArray = System.IO.File.ReadAllBytes(@"image file path");
base64ImageRepresentation = Convert.ToBase64String(imageArray);

Declared base64ImageRepresentation as string argument in uipath and stored in string variable.

I’m populating in message box base64ImageRepresentation variable
But I’m receiving empty base64ImageRepresentation variable
Can anyone solve this issue ???

Here is vb.net code I’m able to get base64 string when I run code in visual studio but Unable to return base64 string when I run code in uipath.
Dim imageArray As Byte() = System.IO.File.ReadAllBytes(“C:\Users\gowth\Downloads\IMG_20190724_115740_HDR.jpg”)
Dim base64ImageRepresentation As String = Convert.ToBase64String(imageArray)
Console.WriteLine(base64ImageRepresentation)
Console.ReadLine()

1 Like

Hi
Get the base64ImageRepresentation as a OUT argument in the INVOKE VBA activity and you can use that argument in the studio

Cheers @Gowtham_Dhanekula

Hello Gowtham,
In this video, I upload a file to Salesforce from UiPath Studio using Conversion ToBase64:

Thanks,
Cristian Negulescu

1 Like