File Upload Flow#
CloudPaste's upload flow is centred on the UppyUploadModal component, which is embedded inside the Mount Explorer (MountExplorerView). As of PR #216, the former standalone /upload page has been removed; /upload now redirects to MountExplorer, and upload availability depends solely on whether the current directory is writable โ not on any global site setting.
Entry Points#
| Surface | How upload is triggered |
|---|---|
| Mount Explorer | FileOperations toolbar โ @openUploadModal โ handleOpenUploadModal |
Standalone /upload (removed) | Redirected to MountExplorer since PR #216 |
UppyUploadModal is conditionally rendered with v-if="hasEverOpenedUploadModal" and toggled via :is-open to avoid destroying its Uppy state on every close .
UppyUploadModal Initialisation (setupUppy)#
When the modal opens (or currentPath / darkMode / locale changes), setupUppy() runs the following sequence:
- Destroy any existing Uppy instance and dispose the FS adapter/session.
- Initialise a fresh Uppy core via the
useUppyCorecomposable (id"new-uppy-dashboard"). - Create a
UppyPluginManagerโ registers media capture plugins (webcam, screen, audio, image editor, URL import) . - Mount the Dashboard plugin inline into
UppyDashboardContainer. configureUploadMethod()โ resolves the storage config for the current path, then resolves the driver and applies the FS uploader adapter .configureServerResumePlugin()โ installs or removesServerResumePlugindepending on whether multipart mode is active.configureSha256PreprocessPlugin()โ installsSha256PreprocessPluginif the storage driver requires SHA-256 for pre-signing (e.g. HuggingFace LFS).
Composables used: useUppyCore, useUppyEvents, useUppyPaste, useUppyBackendProgress (all from frontend/src/composables/uppy/) .
Storage Resolution#
getStorageConfigIdForCurrentPath() extracts the first path segment (mount root) and looks it up against the loaded mounts list to find the associated storage_config_id. ensureStorageConfigForCurrentPath() then ensures the config is loaded in storageConfigsStore, falling back to the admin storageConfigService if needed.
resolveDriverByConfigId() resolves the in-memory cached driver for that config, or builds a new one keyed on storage_type.
Upload Strategy Selection#
Four strategies are defined in STORAGE_STRATEGIES:
| UI option | Strategy constant | Transport |
|---|---|---|
presigned | PRESIGNED_SINGLE | Direct PUT to storage pre-signed URL |
multipart | PRESIGNED_MULTIPART | Multi-part pre-signed upload (resumable) |
stream | BACKEND_STREAM | PUT via backend relay (/fs/upload) |
form | BACKEND_FORM | POST form via backend relay |
enforceUploadMethodByDriver() reads the driver's capabilities.fs flags and disables unsupported modes, auto-falling back to the next available method. The chosen strategy is mapped via strategyMap and passed to the FS adapter and upload session.
Upload Execution (startUpload)#
startUpload() runs when the user clicks Start Upload:
- Re-resolves the storage config and driver to enforce the final strategy.
- Creates a
createFsUploadSession(fromuseShareUploadController) withstorageConfigId,strategy, andpath. - For stream mode, starts backend progress polling via
useUppyBackendProgress. - On completion, calls
runFsCommitIfNeeded()โ forPRESIGNED_SINGLEstrategy, batch-commits uploaded files via the storage adapter before emittingupload-success. - Emits
upload-successwith a summary including a deduplication/instant-upload (skippedUploadCount) count .
Post-Upload Sharing (PR #216)#
PR #216 added an optional share-link generation step inside UppyUploadModal. After successful upload, if the user enabled the checkbox, createSharesForUploaded() calls createShareFromFileSystem() for each uploaded file, with configurable password, expiry, max views, and remark . Share results are displayed inline with copy/QR-code buttons.
Key Files#
| File | Role |
|---|---|
UppyUploadModal.vue | Main upload modal โ orchestrates Uppy, plugins, strategies, and commit |
MountExplorerView.vue | Host view; renders modal and wires upload events |
storage-core/drivers/types.js | STORAGE_STRATEGIES constants |
storage-core/drivers/registry.js | resolveDriverByConfigId factory |
composables/uppy/ | useUppyCore, useUppyEvents, useUppyPaste, useUppyBackendProgress |
modules/upload/shareUploadController.js | useShareUploadController โ session lifecycle management |
modules/storage-core/uppy/UppyPluginManager.js | Media plugin registry (webcam, audio, screen, URL import) |
modules/storage-core/uppy/plugins/ServerResumePlugin.js | Resumable multipart upload detection |
modules/storage-core/uppy/plugins/Sha256PreprocessPlugin.js | SHA-256 pre-computation for LFS-style pre-signing |