Creating new document from image base64 text

Creating new document from image base64 text


        blob fileContent = EncodingUtil.base64Decode(fileData); //fileData is base64 data of image. 
  Attachment a = new Attachment(parentId = parentId); // parentId : Id of record.
  a.body = fileContent;
  a.name = 'ImageName.png';
  insert a;

No comments:

Post a Comment