We are trying to get the base64 of an image we have uploaded by trying to get it from skuid.$M(“model”).datad0].Body.realBlobValue.asByteArray. With some images it works but with others the value is not there with the only field after skuid.$M(“model”).data0].Body.realBlobValue being .file and it returns a value that looks like a filepath ": “/tmp/bvf/blob2885374293920319543.bvf”. We would just like a little background on where to go or what to do so that we can consistently grab the base64 of the image that is uploaded
Page 1 / 1
Pablo has the answer:
A little adjustment, It seems that depending of the filetype the body object is different. so for HTML files the base64 is not in .realBlobValue.asByteArray is in .asByteArraySee the full thread here: https://community.skuid.com/t/embed-attached-html-file
var field = arguments[0];var value = arguments[1];
$=skuid.$;
var Base64content;
if(value.realBlobValue!==undefined){
Base64content=value.realBlobValue.asByteArray;}
else{
Base64content=value.asByteArray;
}
var contenttype=field.row.ContentType;
var show=“<iframe src=”“data:”+contenttype+“;base64,”+Base64content+“”“>”;
skuid.ui.fieldRenderersi‘TEXT’]field.mode;//empty
var iframe = $( ‘’ ).addClass(‘previewiframe’).attr(‘src’,‘data:’+contenttype+‘;base64,’+Base64content+‘’).appendTo(field.element.find(‘div’));
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.