Convert base64 into bytes[] & save in SQL as Image datatype

Hi All,

Can anybody suggest me. How to convert base64 into bytes in servoy web client.
Pass after conversion to DB for saving that bytes as into SQL Datatype Image.

Is there any Plugin available for it. Please suggest

Thanks in Advance.

The svyUtils module has a function base64DecodeAsBytes in the scope svyCrypto.

Also, you can use this:

Packages.org.apache.commons.codec.binary.Base64.decodeBase64(string);

juan.cristobo:
Also, you can use this:

Packages.org.apache.commons.codec.binary.Base64.decodeBase64(string);

Which is what the svyUtils uses :)

/**
 * @private
 * 
 * @param {String} encodedStr
 * 
 * @return {Array<byte>}
 * 
 * @properties={typeid:24,uuid:"B94FC7D2-63AC-4CAB-9A14-26F400C06842"}
 */
function base64DecodeAsBytes(encodedStr) {
	var b64 = new Packages.org.apache.commons.codec.binary.Base64();
	/** @type {Array<byte>} */
	var bytes = b64.decode(encodedStr);
	return bytes;
}

https://github.com/Servoy/svyUtils/blob … yCrypto.js

Oh! :D :D :D