New answers tagged


The Issue was on my VF-JS side - Instead using this line window.btoa(reader.result) I used reader.result.replace(/^data:.+;base64,/, ''), and the encoding works well. Along with the change that @sfdcfox suggested in my apex controller side - EncodingUtil.base64decode(this.base64); instead of Blob.valueOf(this.base64);


You've base-64 encoded the data, but then you didn't reverse the encoding. This change should fix your problem: testContentInsert.VersionData = EncodingUtil.base64decode(this.base64);


SELECT ContentDocumentId, linkedEntityId FROM ContentDocumentLink WHERE LinkedEntityId = "123" ContentDocumentId = a salesforce object Id where this file is being used , linkedEntityId = id of the stored file

Top 50 recent answers are included