function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

HTML Base64(Images) to Files: Knowledge Articles

Hi Ohana,
We are in process of moving knowledge Articles.
Source HTML files have image references in Base64 code instead of actual file references. SF knowledge import tool is unable to parse Base64,expects image references.
Each HTML file has 15+ image references,with thousands of knowledge articles(HTML files). 
Appreciate solution here: Any tool/code which can convert base64 to images and update html with image references
SwethaSwetha (Salesforce Developers) 
HI Jotmenow,

One possible solution to convert Base64 code to images and update HTML with image references is to use a code or tool that can decode Base64 strings and generate images from them.

You can try You can copy and paste the Base64 code into the tool and it will show you the image and provide a download link for it

If you are familiar with Salesforce Apex, you can write a code that can decode Base64 strings and generate images from them. You can use the Blob.valueOf() method to convert the Base64 code to a Blob, and then use the ContentVersion object to insert the image into Salesforce and get its file reference. Then you can update the HTML files with the file references to the saved images

Once you have converted the Base64 code to images and updated the HTML files with the file references, you can use the Salesforce Knowledge import tool to import the updated HTML files into Salesforce


If this information helps, please mark the answer as best. Thank you