如何从 react-bootstrap formcontrol 组件获取文件数据
how to get the file data from a react-bootstrap formcontrol component
我正在使用表单控件组件通过 AJAX 调用将图像传递到 API 端点。到目前为止,我无法找到有关如何实际定位实际文件数据的信息。
你可以通过onChange获取文件:
<FormControl type="file" onChange={(e) => console.log(e.target.files)}/>
其中 e.target.files 是一个包含 0 或 1 个文件的文件列表。
我正在使用表单控件组件通过 AJAX 调用将图像传递到 API 端点。到目前为止,我无法找到有关如何实际定位实际文件数据的信息。
你可以通过onChange获取文件:
<FormControl type="file" onChange={(e) => console.log(e.target.files)}/>
其中 e.target.files 是一个包含 0 或 1 个文件的文件列表。