Conversion to Base64 format

file
string
base64

#1

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


#2

Hi @dubeychanan,

Refer this link,
https://stackoverflow.com/questions/25919387/c-sharp-converting-file-into-base64string-and-back-again/25919641

https://mobile.codeguru.com/columns/dotnet/base64-encoding-from-c.html

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


#3

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


#4

Hi @dubeychanan,

Apply this code in your flow…and try it.

Regards,
Arivu


#5

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