Overview
Uploadcare File Uploader can be integrated into any web project using vanilla JavaScript. This guide covers both CDN and npm package approaches.CDN Installation
Quick Setup
The fastest way to get started is using the CDN:index.html
Replace
YOUR_PUBLIC_KEY with your actual Uploadcare public key from your dashboard.NPM Installation
Install Package
For build-tool-based projects:Basic Setup
main.js
index.html
Handling Upload Events
Listen to upload events using the context provider:Configuration Options
Configure the uploader using attributes:Common Configuration Attributes
| Attribute | Type | Description |
|---|---|---|
pubkey | string | Your Uploadcare public key |
multiple | boolean | Allow multiple file uploads |
img-only | boolean | Restrict to image files only |
source-list | string | Comma-separated upload sources |
max-local-file-size-bytes | number | Maximum file size in bytes |
multiple-min | number | Minimum number of files |
multiple-max | number | Maximum number of files |
Available Solutions
Choose the right uploader for your needs:- Regular
- Inline
- Minimal
Full-featured modal uploader:Best for standard upload workflows.
Form Integration
Integrate with HTML forms:Dynamic Configuration
Update configuration programmatically:Custom Styling
Customize appearance using CSS variables:Multiple Uploaders
Use different context names for multiple uploaders:Best Practices
Use Unique Context Names
When using multiple uploaders, assign unique
ctx-name values to each configuration.Load from CDN or Bundle
Choose either CDN (for quick prototypes) or npm package (for production builds).
Troubleshooting
Components Not Rendering
Ensure you’ve calleddefineComponents(UC) before the DOM is ready:
CSS Not Loading
Verify the CSS link is correct and matches your chosen solution:Events Not Firing
Make sure you’re listening to events on theuc-upload-ctx-provider element:
Next Steps
Configuration
Explore all configuration options
Events API
Learn about available events
Live Examples
View complete JavaScript examples
Styling
Learn how to customize the appearance