Conversion to Base64 format

Hi

We have a requirement to call a webservice , Webservice is to load documents to the destination system . As an input argument Webservice expect document in Base64 format , can you please suggest how can i convert a .docx format to base64 format in UI Path .

Any quick help is welcome , looking forward for a quick suggestion here .

Thanks
Chandan

Hi @dubeychanan,

Refer this link,
c# - Converting file into Base64String and back again - Stack Overflow

If you want for some reason to convert your file to base-64 string. Like if you want to pass it via internet, etc… you can do this

Byte[] bytes = File.ReadAllBytes("path")
String file = Convert.ToBase64String(bytes)
And correspondingly, read back to file:

Byte[] bytes = Convert.FromBase64String(b64Str)
File.WriteAllBytes(path, bytes)

Regards,
Arivu

4 Likes

Thanks Arivu , this is an exceptional fast reply ,any suggestion how can i invoke this code in UI path .

Hi @dubeychanan,

Apply this code in your flow…and try it.

Regards,
Arivu

thanks for the code , I wanted to know how to execute this code in UI path Sequence , i mean any activity to do so , i m sorry for this question I am very new to UI Path

You can add into Invoke code activity
Note: Need to add respective namespace

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

Thanks,
Cristian Negulescu

4 Likes

Hey @dubeychanan, i was looking earlier to do the same thing and based on what i saw in @Cristian_Negulescu video i did it like this. I used only Assign activities in order to keep it simple and i managed to convert images, pdf’s and docx to Base64.

I attached the sequence in case you or someone else will need it in the future.


ConvertImagePathToBase64String.zip (1.4 KB)

Cheers!
Cristi

5 Likes