Skip to content

Feat(file): add support of the chunked file upload - #3661

Open
Koc wants to merge 4 commits into
mainfrom
feature/chunked-file-upload
Open

Koc wants to merge 4 commits into
mainfrom
feature/chunked-file-upload

Conversation

@Koc

@Koc Koc commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #3449.

🎥 Demo

nextcloud-chunk-upload-2026-09-28_15.26.13.mp4

What changed

File question uploads previously used a single multipart POST request per
selection. Files were limited by PHP upload limits and not paralleled. Also now we're displaying progressbar during upload.

Uploads now go through a temporary public upload share and the standard
Nextcloud WebDAV endpoint, the same mechanism used by the Files app:

  1. POST .../submissions/files/{questionId}/share creates a temporary folder
    in the form owner's storage and shares it via a create-only (file drop)
    public link.
  2. The file is uploaded over public.php/dav using the uploader from
    @nextcloud/files (MKCOL workspace, parallel chunk PUTs, MOVE assemble).
    Chunking requires the dav.public_shares_chunking capability; smaller
    files are sent as a plain PUT.
  3. POST .../submissions/files/{questionId}/register binds the uploaded file
    to the form and question and returns uploadedFileId + uploadToken,
    which are submitted as the answer exactly as before.

Behavior changes

  • Large files are uploaded in chunks with parallel requests and show per-file progress instead of a single "Uploading …" indicator.
  • Uploads can be cancelled per file.
  • Works for public (anonymous) submissions, since files are uploaded through a public share owned by the form owner.
  • If the share or WebDAV upload fails, the client falls back to the previous multipart endpoint, so instances with disabled/restricted link shares keep working.
  • Stale upload shares and folders are removed by the existing CleanupUploadedFilesJob.

API

Two new endpoints (see docs/API_v3.md / openapi.json):

  • POST /api/v3/forms/{formId}/submissions/files/{questionId}/share
  • POST /api/v3/forms/{formId}/submissions/files/{questionId}/register

The existing POST .../files/{questionId} multipart endpoint is unchanged
and remains supported.

Dependencies

  • @nextcloud/files ^4.1.0 (new uploader, public chunking support)
  • @nextcloud/vue ^9.12.0

How to test

  1. Create a form with a file question and open it as a logged-in user and
    via a public share link.
  2. Upload a small file and a large file (> chunk size) and verify progress
    is shown and the submission succeeds.
  3. Upload two files with the same name (conflict rename) and cancel an
    upload in progress.
  4. Disable link sharing (or enforce link passwords) and verify the
    multipart fallback still works.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

@Koc
Koc force-pushed the feature/chunked-file-upload branch 2 times, most recently from 13e382e to a7c89d1 Compare September 14, 2026 18:13
@Chartman123 Chartman123 added this to the 5.5 milestone Sep 15, 2026
@Koc
Koc force-pushed the feature/chunked-file-upload branch from fa30648 to a21d58d Compare September 26, 2026 22:41
Koc added 2 commits September 28, 2026 11:01
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
@Koc
Koc force-pushed the feature/chunked-file-upload branch from a21d58d to 78099e0 Compare September 28, 2026 09:02
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
@Koc
Koc force-pushed the feature/chunked-file-upload branch from 78099e0 to 477a45f Compare September 28, 2026 12:40
@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 16.47059% with 142 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/Controller/ApiController.php 18.32% 107 Missing ⚠️
lib/BackgroundJob/CleanupUploadedFilesJob.php 18.18% 18 Missing ⚠️
lib/Db/FormMapper.php 0.00% 10 Missing ⚠️
lib/Db/UploadedFileMapper.php 0.00% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Koc
Koc marked this pull request as ready for review September 28, 2026 13:32
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
@Koc
Koc force-pushed the feature/chunked-file-upload branch from 8733e08 to 9101ab5 Compare September 28, 2026 13:36

@Chartman123 Chartman123 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two quick changes that came into my mind while watching the video :) I think "assembling" is too technical here for most users.

<div v-if="activeUpload.assembling" class="upload-status">
<progress
:aria-label="
t('forms', 'Assembling file {fileName}', {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t('forms', 'Assembling file {fileName}', {
t('forms', 'Finishing upload for file {fileName}', {

fileName: activeUpload.name,
})
" />
{{ t('forms', 'Assembling file …') }}

@Chartman123 Chartman123 Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also no space before the ellipsis

Suggested change
{{ t('forms', 'Assembling file …') }}
{{ t('forms', 'Finishing upload…') }}

@Koc

Koc commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator Author

@Chartman123 I agree with you, but this terminology comes from the original library. Should we stay consistent in naming?

@Chartman123

Copy link
Copy Markdown
Collaborator

@Chartman123 I agree with you, but this terminology comes from the original library. Should we stay consistent in naming?

I've asked the designers :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no just use NcUploadPicker ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use @nextcloud/upload for chunked file uploads

3 participants