You need to sign in to do that
Don't have an account?
AJ Mayerhofer
How to handle files in Apex?
Hi all, I'm trying to create a button where the user can upload a pdf, and that pdf is then sent to the Docparser API.
What I currently have is the code from the Docparser API to send an Attachment object: https://github.com/Docparser/Docparser-Apex/blob/master/upload_document.apx
This would work, but I'm not sure how to get a pdf into an Attachment object, and I'm not sure if Attachment is even used in Apex anymore. There are "Salesforce Files" on Lightning which I have been able to manually upload pdfs to, but I'm not sure how to upload to/access them in code.
How do I get a pdf file into an Attachment or File (using an <apex:inputFile>)? What I need for sending information to Docparser is the name of the file and base64 encoded file data.
Thank you for any help.
What I currently have is the code from the Docparser API to send an Attachment object: https://github.com/Docparser/Docparser-Apex/blob/master/upload_document.apx
This would work, but I'm not sure how to get a pdf into an Attachment object, and I'm not sure if Attachment is even used in Apex anymore. There are "Salesforce Files" on Lightning which I have been able to manually upload pdfs to, but I'm not sure how to upload to/access them in code.
How do I get a pdf file into an Attachment or File (using an <apex:inputFile>)? What I need for sending information to Docparser is the name of the file and base64 encoded file data.
Thank you for any help.
you need to create a new attachment reord.
if you want a file.
you need to create a new contentversion record