2 answers
// this code is attachment of pdf=====public void saveAttachment(){ String encodedContentsString = System.currentPageReference().getParameters().get('fileContents'); Id accountId = System.currentPageReference().getParameters().get('accountId'); Attachment attachment = new Attachment(); attachment.Body = Blob.valueOf(encodedContentsString); attachment.Name = String.valueOf('test.txt'); attachment.ParentId = accountId; insert attachment;}==========================//If this is my code thn how to attach file as attachment