Skip to main content
Nintex Community Menu Bar
Question

File Upload issue

  • July 11, 2024
  • 1 reply
  • 10 views

Forum|alt.badge.img+2

We are trying to get the base64 of an image we have uploaded by trying to get it from skuid.$M(“model”).data[0].Body.realBlobValue.asByteArray. With some images it works but with others the value is not there with the only field after skuid.$M(“model”).data[0].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

This topic has been closed for replies.

1 reply

Forum|alt.badge.img+18

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 .asByteArray

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.fieldRenderers[‘TEXT’]field.mode;//empty
var iframe = $( ‘’ ).addClass(‘previewiframe’).attr(‘src’,‘data:’+contenttype+‘;base64,’+Base64content+‘’).appendTo(field.element.find(‘div’));

See the full thread here: https://community.skuid.com/t/embed-attached-html-file