DocsFiles & media
On this page

Resume an interrupted upload

Restore an upload session and display its live state.

Before you begin: Show upload progress.

Resume Interrupted Uploads

Use one API: Frontbacked.uploads.resume().

The simplest version takes a post object or post id:

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

If the original file is not already available in the current page, Frontbacked opens a small resume modal. The user chooses the same file, gets a preview when possible, and the upload continues from the uploaded parts instead of starting over.

You can also supply files yourself:

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

For fully custom UI, return the file from onFile:

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Frontbacked.uploads.pending(post) returns only unfinished files discovered in a post:

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

The result shape is:

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Live Upload State

Reading a post restores its saved upload feedback. Use a .live binding to keep that feedback current as upload parts arrive, including after a page refresh. This works on ordinary pages with any post type and file field: images, PDFs, audio, videos, and nested attachments.

index.html

post.uploads contains pending uploads for the current uploader, including uploads to an empty file field on an existing post. Each entry identifies its sessionId, postId, postType, fieldPath, fileName, mimeType, status, progress, uploaded, and total. The post's read permissions still apply. Other visitors do not receive these entries or upload-only live updates.

A replacement also exposes feedback at post.data.yourFile.upload.replacement while the original file stays saved. After the replacement is saved, it becomes the file's normal metadata. A video's .media.status and .media.progress then describe preparation for playback; keep the same .live binding to receive those updates.

Uploads started through createPost, uploadPost, or updatePost automatically recover after a refresh on supported browsers. Frontbacked keeps a local copy in chunks, resumes only the parts the server still needs, and finishes the original save. This works for any post type and file field, including replacements and multiple attachments. Keep a .live binding to receive upload and video preparation feedback without polling.

The local copy shrinks as confirmed parts arrive. If the entire file cannot fit, Frontbacked keeps the tail and retries saving the remaining bytes as the upload progresses. Automatic recovery becomes available once every unconfirmed part is stored locally. Before that point, keep the page open. Refreshing interrupts the active transfer; it resumes when you reopen the page while signed in.

Your existing onUploadProgress callback also receives recoveryReady and recoveryMessage when local recovery storage is available. Use the message alongside your progress indicator to explain whether a refresh can recover the upload. Browser storage can be unavailable, cleared, or evicted; Frontbacked still allows uploading in those cases. Local recovery copies expire after 24 hours and are removed after the original save succeeds. Only the same account on the same browser can recover its pending saves.

When required bytes are unavailable, the saved feedback remains visible. Use the existing resume helper to select the original file again:

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Frontbacked.uploads.pending(post) and Frontbacked.uploads.status() recognize feedback restored by a normal query or .live binding. No status polling is needed.

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Continue with Set site images and previews.