react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

FileInput doesn't accept multiple files when setting 'multiple' property using options prop

Open lihop opened this issue 8 years ago • 1 comments

What you were expecting: A FileInput that accepts multiple files.

What happened instead: The input only accepts a single file.

Steps to reproduce: Set multiple using the options prop rather than the multiple prop.

From the docs:

The FileInput component accepts an options prop into which you can pass all the react-dropzone properties. For instance, if you need to upload several files at once, just add the options={{ multiple: true }} DropZone attribute to your field.

Related code:

<FileInput source="files" options={{ multiple: true }}>
    <FileField source="src" title="title" />
</FileInput>

Other information: I will create a pull request for FileInput to check the options prop in addition to the (legacy?) multiple prop. Otherwise, we should update the documentation to mention the multiple prop.

Environment

  • React-admin version: 2.2.0

lihop avatar Aug 10 '18 05:08 lihop

Try this , It worked for me. It will return array of raw files

<FileInput source="files"  multiple = {true} >
    <FileField source="src" title="title" />
</FileInput>

fullstacksk avatar May 11 '21 09:05 fullstacksk