files-ui / files-ui-react

UI components for file uploads with React js. Files UI is a complete library for handling files in the UI. You can validate and upload them. Multilanguage. Server side support.
https://www.files-ui.com
MIT License
46 stars 9 forks source link

addExtraData #24

Open memcaliber opened 1 year ago

memcaliber commented 1 year ago

i have code in react JS: import {addExtraData } from '@files-ui/react'

how to using addExtraData , i want to send form data with uploading image to server.

OneHatRepo commented 11 months ago

I was looking for this same functionality.

The addExtraData method is an internal function to the library. What you really want is the "extraUploadData" property of an ExtFile. Add this property in DropZone.onChange and it will be sent to the server.

onDropzoneChange = (files) => {
    _.each(files, (file) => {
        file.extraUploadData = {
            test1: true,
        };
    });
},