Upload a File to a specific Library Folder using Salesforce Apex

ContentDocumentLink record should be created with LinkedEntityId as the Library Id to upload a File to a specific Library Folder using Salesforce Apex. In the following example, when Files are uploaded to Case records, it will link them to a Library with the name ‘Public Library”. Sample Apex Trigger: