zefoy / ngx-dropzone-wrapper

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

How to pass extra parameters #32

Closed nileshyadav326 closed 7 years ago

nileshyadav326 commented 7 years ago

Hi i want to pass extra form data with the file , can u suggest any hack is available . in angular 2 version.

sconix commented 7 years ago

Don't think any hacks are needed, check the Dropzone documentation how to do that.

nileshyadav326 commented 7 years ago

as per the documentation, hidden data will auto submitted. https://github.com/enyo/dropzone/wiki/FAQ#how-to-submit-additional-data-along-the-file-upload

but I want to submit other fields type (i.e text , radio ) data also.

sconix commented 7 years ago

There is also documentation saying that all form inputs are included not just hidden, don't know which is true. Quick look at the code makes me think that all inputs are included, but don't know. Anyway this is more of a question for Dropzone that for this wrapper.

nileshyadav326 commented 7 years ago

ok I tried this option and able to send the other params

 public config2: DropzoneConfigInterface = {
        server: 'https://httpbin.org/post',
        paramName: 'imageFile1',
        sending: function (file, xhr, formData) {
            formData.append("insurance_type", 'test');  //name and value
            formData.append("insurance_expirationdate", 'tests'); //name and value

        }
    };