Upload Files in Lightning Component

Hey guys, In this post we are going to learn about how to upload files in Salesforce lightning component.
In this example we will attached the files from Custom sObject by help of wrapper apex class in lightning component.
Files we used in this post example:-
uploadAttachmentCmp.cmp
Lightning Component
It is used to user interface display upload button and toast success message on browser.
uploadAttachmentCmpConroller.js
JavaScript Controller File
It is used for client side javascript function that is communicate to apex class method.
uploadFileController.apxc
Apex Class Controller
Upload the file into database server
Custom Object:- childObjTrigger__c
Custom Object
Upload the attachment files on custom sObject Files & Attechment section.
Final Output

Other post that would you like to learn
Note:- Custom sObject >> childObjTrigger__c
You need to change custom sObject name with your custom sObject name.
Step 1:- Create Lightning Component : uploadAttachmentCmp.cmp
From Developer Console >> File >> New >> Lightning Component
uploadAttachmentCmp.cmp [Lightning Component File]
Step 2:- Create Lightning Component : uploadAttachmentCmpController.js
From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller
uploadAttachmentCmpController.js [JavaScript Controller]
Step 3:- Create Lightning Application : uploadFileController.apxc
From Developer Console >> File >> New >> Apex Class
uploadFileController.apxc [Apex Class Controller]
Originally published at https://www.w3web.net on July 27, 2020.