I'm using the q-uploader element (https://quasar.dev/vue-components/uploader) with NodeJS in the backend.
I've been trying to add some additional form fields to the POST request, but it doesn't work. This is what I tried:
<q-uploader
url="http://localhost:3000/api/upload/new"
label="Max. size: 10 MB"
accept=".pdf, image/*"
max-file-size="10485760"
with-credentials
:form-fields="[{name: 'name', value: 'value'}]"
@rejected="onRejected"
/>
The upload itself works OK but unfortunately without the additional form fields, as I can see from the network tab and also on the backend side. On NodeJS side:
router.post("/api/uploads/new", async (req, res) => {
const form = new formidable.IncomingForm();
console.log(req.body); // returns {}
console.log(form); // returns the uploaded file
...
}
The request returns an empty document {}, however, the file arrives so in principle, it's working. What am I missing?
Thanks a lot!