Salesforce Developers Blog: How to Build a Lightning File Uploader Component

UI Pattern for Uploading Files to Salesforce in Lightning Components

Although Salesforce plans to introduce a basic file upload component in the future, as of Spring 2017, there is none for Lightning components. This article covers one of two methods for creating a file uploading component. This brief tutorial is for developers who are already familiar with Lightning Components. It also includes a 4-minute video showing the process and results.

Jaswinder Rattanpal shows how to how to build a file uploader in Lightning components using Visualforce by attaching them to a Salesforce record. His method allows the Lightning component to communicate with Visualforce. Once the upload process is complete, Visualforce will display a success or error message.

Jaswinder’s Visualforce approach allows uploading larger files (up to 10 MB) in Lightning Experience through Lightning components. Presently the Visualforce view state is limited to 135 KB. This component can be dropped onto any record.

All source code used in this post is available in a GitHub repository.