MobileCRM.Application.writeFileFromBase64 - Resconet/JSBridge GitHub Wiki

Asynchronously writes the base64-encoded data into the application local storage file.

Arguments

Argument Type Description
path String Defines the relative path of the file in the application local data.
base64 String A string containing the base64-encoded file content.
success function() A callback function which is called in case of success.
failed function(error) A callback function for command failure. The error argument will carry the error message.
scope A scope for calling the callbacks; set "null" to call the callbacks in global scope.

This example demonstrates how to store the image data into application storage root and show it in <img> element using relative URL.

function saveAndShowImage(base64ImageData) {
	/// <param name="base64ImageData" type="String">String containing base64-encoded image data.</param>
	MobileCRM.Application.writeFileFromBase64("ExternalImage.jpg", base64ImageData, function () {
		var imgElement = document.getElementById("test-image");
		imgElement.src = "../ExternalImage.jpg"; // Offline HTML is opened from the WWW folder and image was stored into the root folder
	}, MobileCRM.bridge.alert);
}
⚠️ **GitHub.com Fallback** ⚠️