Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tus - MetaFields not added to request header #3451

Closed
Elfangor93 opened this issue Jan 25, 2022 · 1 comment
Closed

Tus - MetaFields not added to request header #3451

Elfangor93 opened this issue Jan 25, 2022 · 1 comment
Labels

Comments

@Elfangor93
Copy link

I would like to use the Tus file upload method to take advantage of the piecewise uploading of large files. Additionally I have the need of sending further data with the file to the server. Therefore I would like to use the metafields in the response header. As described in https://uppy.io/docs/tus/#metaFields-null and https://tus.io/protocols/resumable-upload.html#upload-metadata.

My code is looking like this:

let { Tus } = Uppy
let uppy = new Uppy.Core();
uppy.use(Uppy.Dashboard, {
        inline: true,
        target: '#drag-drop-area',
        showProgressDetails: true,
        metaFields: [
          { id: 'name', name: 'Name', placeholder: 'file name'},
          { id: 'description', name: 'Description', placeholder: 'description of the file' },
          { id: 'owner', name: 'Author', placeholder: 'author of the file' }
        ],
});
uppy.use(Tus, {
        endpoint: '/uppy/tus/upload.php',
        retryDelays: [0, 1000, 3000, 5000],
        metaFields: null,
 })
uppy.on('complete', (result) => {
        console.log('successful files:', result.successful);
        console.log('failed files:', result.failed);
});

I would now expect the metaFields to appear in the request header when uploading a file. But there isn't. Is there something I missed?

grafik

@Murderlon
Copy link
Member

I think you are confused between Uppy metafields and the metafields value for Tus. meta fields in uppy will be shown in the dashboard, and will be added to the file meta data. Meta fields on tus will filter what is send along, not added.

If you want to change Tus headers dynamically, checkout this comment. If you want to send meta data per file, use uppy metafields.

Closing this but feel free to continue the discussion here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants