pqina / vue-filepond

🔌 A handy FilePond adapter component for Vue
https://pqina.nl/filepond
MIT License
1.92k stars 128 forks source link

Get fieldName on remove #210

Closed AO-IO closed 2 years ago

AO-IO commented 3 years ago

How to get a field name when remove is called?

remove: (src, load) => {
          // console.log("revert", src);
          load();
        },

this only gives the URL of the image.

I have multiple fields and I need the name of each field and send it in the request body of remove. is it possible?

rikschennink commented 3 years ago

I don't know how you'd do it in Vue but for JS it's something like:

const createServer = (fieldName) => {
  remove: (src, load) => {
    // can now use fieldName here
  }
}

FilePond.create({
  server: createServer('my-field')
})
AO-IO commented 3 years ago

I don't know how you'd do it in Vue but for JS it's something like:

const createServer = (fieldName) => {
  remove: (src, load) => {
    // can now use fieldName here
  }
}

FilePond.create({
  server: createServer('my-field')
})

im thinking of passing the item to the remove function in filepond.js and get the metadata from there,, because i have the field name in the metadata .. is it a bad idea?

rikschennink commented 3 years ago

@AO-IO I'm not sure what you mean, please elaborate