Upload a file as a static resource in Setup so your Visualforce, Aura, or Lightning Web Component code can reference it by name. The steps below create a single resource; package it in a ZIP first if you need to upload several related files together.
- Open Static Resources in Setup
From Setup, type Static Resources into Quick Find and select it, then click New to start a new resource.
- Name the resource
Enter a Name that begins with a letter and uses only letters, numbers, and single underscores. Avoid spaces, trailing underscores, and consecutive underscores. Add a Description so future admins know what the file is for.
- Upload the file
Click Browse and choose the file. It must be 5 MB or smaller. To bundle a library with its images and stylesheets, zip them together and upload the single archive.
- Set Cache Control
Choose Public for files served on public Sites or Experience Cloud guest pages, or Private for resources that should reach only authenticated users in the org. Then click Save.
- Reference it from code
In Visualforce use $Resource.YourName, in LWC import from @salesforce/resourceUrl/YourName, and in Aura use the $Resource value provider. For a file inside a ZIP, use URLFOR($Resource.YourName, 'path/file.ext').
The unique identifier code uses to reference the resource. Must begin with a letter and contain only alphanumeric characters and underscores, with no spaces or consecutive or trailing underscores.
The uploaded file itself, up to 5 MB. Can be a single asset or a ZIP or JAR archive that packages many files together.
Public shares one cached copy with all traffic for faster loads; Private keeps the cached copy in each user session and limits it to authenticated users.
- The 5 MB per-resource cap is hard. Split or minify any library that exceeds it rather than trying to upload the full bundle.
- Renaming a resource auto-updates Visualforce markup, but it does not fix references in Apex or LWC. Check that code by hand before renaming.
- Choosing Private on a resource served from a public Site can stop it from caching as expected, which shows up as slow first loads for guests.