Is it possible to add reactive parameter in endpoint when uploading file on vue.js
See original GitHub issueHi, I want to add a dynamic/reactive parameter value which can be added as a path parameter to my endpoint when uploading the file on uppy.
uppy.use(XHRUpload, {
endpoint: `[DYNAMIC_API_URL]/${this.textContent}`,
formData: true,
bundle: true,
headers: {
'Authorization': `Bearer ${token}`
}
})
I do this on mounted
hook.
Here textContent
is a reactive property that we created on Vue js.
But this textContent
is not being reactive property to endpoint URL
that is added
How can we do this?
Thanks in advance!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Uploading Files With VueJS and Axios - Server Side Up
Handling files is always a task. This tutorial will simplify the process and show you how to upload files with VueJS and Axios...
Read more >Vue File Upload with Parameters - Stack Overflow
Hi Guys i create a component to upload files and its working so far, but along with the data I'll like to pass...
Read more >Reactivity in Depth - Vue.js
Component state consists of reactive JavaScript objects. When you modify them, the view updates.
Read more >Intro to Vue.js. Testing on kubernetes - rf-service frontend
In this article I'm showing my first steps in Vue.js by adding simple frontend to the existing rf-service.
Read more >[Solved]-Submit multiple files on form as part of axios post-Vue.js
You can use Base64 encode in client side and add the encoded string to your post request and decode from server side.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For the record, in current Uppy versions you can do:
Hopefully that should properly address this use case 🙏
In the future, there will be an official way to do this using
setOptions()
: https://github.com/transloadit/uppy/pull/1728At the moment, you can override options for XHRUpload specifically using
setState()
:The object merge is important because other plugins may use the
xhrUpload
state to pass information to the plugin as well.(Doing this when an upload is already in progress is not supported and will cause weird unknown breakage.)