我正在使用 react-filepond 处理多个文件。我需要在一个请求中将所有文件一起发送到 API,而不是每个文件多个请求:
// Import the Image EXIF Orientation and Image Preview plugins
import FilePondPluginImageExifOrientation from 'filepond-plugin-image-exif-orientation'
import FilePondPluginImagePreview from 'filepond-plugin-image-preview'
import 'filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css'
// Register the plugins
registerPlugin(FilePondPluginImageExifOrientation, FilePondPluginImagePreview)
function App() {
console.log('TEST');
const [files, setFiles] = useState([])
console.log(files);
return (
<div className="App">
<FilePond
server='/api'
files={files}
allowMultiple={true}
onupdatefiles={setFiles}
labelIdle='Drag & Drop your files or <span class="filepond--label-action">Browse</span>'
/>
</div>
)
}
const rootElement = document.getElementById('root')
ReactDOM.render(<App />, rootElement)
沙盒链接在这里。
我该如何实施?