Configure Tus Endpoint Dynamically

Started by benny-adiwijaya2 replies815 views
benny-adiwijayaOriginal post
#1

Hi, I need to upload file to different path based on user input. I already trying reinitialized uppy on user input. But the endpoint still didn’t change.

window.InitializeUppy = function () {
const TUS_ENDPOINT = ‘http:localhost/files/’ + $(“#user_input”).val();

const uppyDashboard = new Uppy({ logger: debugLogger })
    .use(Dashboard, {
        inline: true,
        target: "#uppy"
    })
    .use(DropTarget, {
        target: document.body
    })
    .use(Tus, { endpoint: TUS_ENDPOINT, limit: 6 });

}

Is there any way to configure tus endpoint dynamically based user input?

MerlijnTransloadit teamAccepted answer
#2

Directly putting user input into the endpoint like that can be a security vulnerability.

This is an XY problem, what is the problem you’re trying to solve? It’s probably better to send along metadata for all files (with meta option) or per file (setFileMeta or onBeforeFileAdded) and do something with it in your tus server.

benny-adiwijaya
#3

Thanks, I am using metadata now