reactjs - 如何使用reactjs在上传文件中给出文件路径?
问题描述
我是新手,我的目标是上传文件并且应该获取文件路径,即,如果我从 D 驱动器上传文件,那么路径应该是“D:\files\hi.pdf”,但在这里我都不能上传文件我也找不到路径。我已经浏览了链接如何解决 C:\fakepath? 我试图在我的代码中应用,但没有成功。
这是代码:
<>
<div className="fileInput">
<Input
type="text"
placeholder="File 1"
id="file-path"
readonly
name="fileName"
value={this.state.fileName}
/>
<Input
type="file"
id="file-id"
name="file"
onChange={this.FileUpload}
/>
<Button icon="paperclip" />
</div>
<Button onClick={this.handleSubmit}>Submit</Button>
</>
任何人都可以在上传文件时帮助我上传和获取路径吗?
解决方案
推荐阅读
- docker - 启用用户命名空间重新映射后,docker 容器中的进程会剥夺哪些权限?
- java - 从 Java 到 Swift 的 CustomComparator
- c++ - 如何编写 Axie 服务器的最小 GraphQL 查询?
- r - 解析url并在粘贴url时获取相同的url
- reactjs - 在反应中用 t.PartialC<{}> 定义的类型上不存在属性“属性”
- reactjs - 为什么我需要在 onChange 事件的处理程序的 return 语句中传递一个函数
- java - 使用循环重置基本财务计算器
- javascript - Javascript 查找以太坊钱包
- google-cloud-platform - CPU 限制未更新
- ios - 尝试在 SwiftUI 应用程序中使列表保持最新