如何使用 FilePond 使选定的文件类型仅作为 docx 可接受?

How can I make the selected file type acceptable only as docx, using FilePond?

如何才能使所选文件类型仅接受为 docx? 我希望所选文件仅具有 docx 扩展名。我应该应用什么样的过滤?我该怎么做?

React 代码示例

return (
    <>
        <Form className='orange-color ml-2'>
            <FilePond
                ref={ref => (ref)}
                allowFileEncode={true}
                allowMultiple={false}
                oninit={() =>
                    console.log("FilePond "+formKey.toString()+" has initialised")
                }

                onupdatefiles={(fileItems) => {
                    const file = fileItems.map(fileItem => fileItem.file)

                    if (file[0]) {
                        const reader = new FileReader();
                        reader.readAsDataURL(file[0]);

                        reader.onload = (event) => {
                            const convertedResult = event.target.result

                            if (convertedResult) {
                                const regex = '(.*)(base64,)(.*)';
                                const matches = convertedResult.match(regex);
                                const val = matches[3];

                                changeSelected(val)
                            }
                        };
                    }
                }

                }
            />
            <Form.Check>
                <Form.Check.Input required
                                  checked={input.value !== null}
                                  style={{display:'none' }}
                />
                <Form.Control.Feedback type="invalid" >Required</Form.Control.Feedback>
            </Form.Check>
        </Form>
    </>
)

Filepond 有一个文件类型插件:https://pqina.nl/filepond/docs/patterns/plugins/file-validate-type/

The File Type Validation plugin handles blocking of files that are of the wrong type. When creating a FilePond instance based on a input type file, this plugin will automatically interpret the accept attribute value.

https://github.com/pqina/filepond-plugin-file-validate-type

acceptedFileTypes={'application/vnd.openxmlformats-officedocument.wordprocessingml.document'} 

代码示例

<Form className='orange-color ml-2'>
                    <FilePond
                        ref={ref => (ref)}
                        allowFileEncode={true}
                        allowMultiple={false}
                        acceptedFileTypes={'application/vnd.openxmlformats-officedocument.wordprocessingml.document'}

......