File Upload

A data component, the File Upload component allows end users to upload and associate files as fields within a record, or remove uploaded files. In some cases, files can be listed in a table, allowing users to click and preview the file; or, a File Upload component can allow users to add an image, such as for a user profile.

Using the File Upload Component

After adding a File Upload component to the page, set the File Properties. End users can upload files by clicking the Upload button and browsing for the file, or files can be dragged and dropped into the upload area.

The File Upload component can be adapted to many uses. The key to its versatility: how you set the Parent Model and File Storage Locations. For example:

  • With the Parent Model set as None, choose a data source and (when permitted) the file storage location. Files will then be uploaded into the specified location in the data source.
  • For more about the specifics of using the File Upload component with different data source types, see:

Using with the Salesforce data source type

The File Upload component has specific properties and options when used with a model on a Salesforce data source type.

Let end users add images with File Upload

While the Image component is an obvious choice when adding images to a page, it doesn’t allow end users to add or edit the image at runtime. The Salesforce data source type provides File Upload properties that allow users add/edit/remove an image on a page—for example, add a profile photo on a user detail page.

Set the File storage location to In field on record, and Display as to File preview/image. Then, select a reference field where the uploaded image will be stored (depending upon the object, you may want to create a new field in Salesforce for this purpose). Users will see an upload box with a default image (also set in the properties pane). They can click this to add their photo; once the image is present, they can delete it or replace it with another.

Avoid size limitations using Lightning’s File Upload component

The File Upload component, when used in a Lightning Experience page, may encounter file size limitations. Skuid’s alternative is to substitute the Lightning File Upload component (which doesn’t have the same size limitations, but does have functionality differences).

Usage [[]]

Check the Use Lightning’s File Upload Component property in the Properties pane to access this feature, which is only available when:

  • Using the Skuid on Salesforce managed package

  • The File Upload’s Data source type property is set to Salesforce

  • File storage is set to one of the following:

    • In content document (with record context)—available with a Parent model

    • In content document—available when the selected Parent Model is None

      Note

      Lightning file size limitations may affect other File Storage options, but Use Lightning’s File Upload Component is only available for the two options indicated above.

Warning

Skuid does not support using the Lightning File Upload option in original component (API v1) popups. However, using the Lightning File Upload component with Ink (API v2) modals is supported.

Functionality differences using Lightning File Upload

When substituting the Lighting File Upload for Skuid’s File Upload component, some functionality will differ or be unavailable.

Note that, while some properties may still appear in the App Composer, they won’t be taken into consideration at runtime.

  • Properties that are not supported in the Lighting File Upload:

    • Basic tab:
      • File Name
      • File Description
    • Advanced tab:
      • Enforce Max File Size
        • Max File Size
  • Features that work differently in the Lighting File Upload:

    • On-upload Failure Actions may not run as expected.

    • On-upload Success Actions and post-upload snippets run after the end user closes the default Lightning confirmation popup.

      Note

      If users close out of their browser window before closing the confirmation popup, success actions and snippets will not run.

Properties

(Just need to look up a property? Try going directly to the Property Library.)

Component properties

Troubleshooting

You can only attach a file to an existing record. [[]]

If attempting to attach a file to a new record that has not yet been saved to the database, the upload will fail. You must first save the record before attaching a file to the record.

Note

This behavior may require workarounds to create records and then upload files to them with the File Upload component, particularly with the Wizard component.

Supported use cases for Skuid’s File Upload component in Salesforce environments

Note

As of Winter 2021, Salesforce enforced security setting changes to guest users on public-facing sites. This means that using the File Upload component with guest users in Salesforce Sites and Communities is not supported. If this change affects you and you would like to discuss your use case, then reach out to your Customer Success or Support representative.

Upload method Salesforce Classic Lightning Experience Salesforce Classic: public-facing community Lightning Experience: public-facing community
Record: In attachment to record Supported Suported for files < 650kB Not supported Not supported
Field: In field on record Supported Suported for files < 650kB Not supported Not supported
Chatter Feed: In Chatter Field Item Supported Not supported Not supported Not supported
Chatter Files: In Chatter Files Supported Not supported Not supported Not supported
ContentDocument: In content document Supported Supported when Use Lightning’s File Upload Component property checked Not supported Supported when Use Lightning’s File Upload Component property checked [*]
ContentDocument with record context: In content document (with record context Supported Supported when Use Lightning’s File Upload Component property checked Not supported Supported when Use Lightning’s File Upload Component property checked [†]
Static Resources: In static resource Supported Suported for files < 650kB Not supported Not supported
[*]Support for this use case began in September 2020 with Spark (12.4.15) and Boston (13.0.5).
[†]Support for this use case began in September 2020 with Spark (12.4.15) and Boston (13.0.5).