zefoy / ngx-dropzone-wrapper

Angular wrapper library for Dropzone
MIT License
174 stars 51 forks source link

How to add parameter in form data ? #50

Closed corelationNut closed 7 years ago

corelationNut commented 7 years ago

Hi,

I have some question about how can I insert form-data parameter with ngx-dropzone-wrapper ?

I would like to add some information file in form-data e.g. file name, file type etc, file size.

for dropzonejs It use below code to insert formData

myDropzone.on("sending", function(file, xhr, formData) {
  // Will send the filesize along with the file as POST data.
  formData.append("filesize", file.size);
});

Thanks, Nuttakron

corelationNut commented 7 years ago

Found it !form-data parameter can be setting inside config

public config: DropzoneConfigInterface = {
    url: '/upload',
    cancelReset: null,
    clickable: true,
    maxFiles: 1,
    autoReset: null,
    errorReset: null,
    params: {
      "fileId": 123
    }

Cool component ! but should update document more 👍

Thanks, Nuttakron

sconix commented 7 years ago

All those details are in dropzone documentation. I don't find it very useful to replicate dropzone documentation since this is just a wrapper :) The link to the dropzone documentation is in the end of readme.