felixrieseberg / React-Dropzone-Component

:camera: ReactJS Dropzone for File Uploads (using Dropzone.js)
MIT License
1k stars 153 forks source link

Params do not works #206

Closed yuriy-voypost closed 4 years ago

yuriy-voypost commented 4 years ago

Hi!

I am trying to add some params for my request but it not working. What am I doing wrong?

this.djsConfig = {
      addRemoveLinks: true,
      acceptedFiles: "image/jpeg,image/png,image/gif",
      params: {
        userId: "someuserId"
      },
    };
this.componentConfig = {
        iconFiletypes: ['.jpg', '.png', '.gif'],
        showFiletypeIcon: true,
        postUrl: '/uploadHandler'
    };
<DropzoneComponent 
  config={this.componentConfig} 
  eventHandlers={eventHandlers} 
  djsConfig={this.djsConfig} 
/>

On the server side I try to catch them: const params = req.params; console.log('PARAMS:', params); // PARAMS: {}

DanielRuf commented 4 years ago

Hi @yuriy-voypost,

This is an option by dropzone. It sets values like hidden inputs. So it is on the body / data like the other fields.

See https://github.com/enyo/dropzone/issues/1166

yuriy-voypost commented 4 years ago

Oh, I see. Thank you.