Carbon: How to get the file content from FileUploader?

Created on 24 Jul 2019  ·  1Comment  ·  Source: carbon-design-system/carbon

What package(s) are you using?

  • [ ] carbon-components
  • [x] carbon-components-react

Summary

Relevant information

I have a fileUploader and I want to get access to the selected file :

handleImportProject(fileUploader) { console.log("Files: ", fileUploader.nodes[0]) //ApiService.importProject(this.state.projectName, file.nodes[0]) //this.toggleImportProjectModal(false) }

How can I achieve that?

question ❓

Most helpful comment

I was missing : onChange={e => this.handleFileChanged(e)

handleFileChanged(e) {
//console.log("File: ", e.target.files[0])
this.setState({selectedFile: e.target.files[0]})
}

>All comments

I was missing : onChange={e => this.handleFileChanged(e)

handleFileChanged(e) {
//console.log("File: ", e.target.files[0])
this.setState({selectedFile: e.target.files[0]})
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

snidersd picture snidersd  ·  3Comments

xrissot-ibm picture xrissot-ibm  ·  3Comments

kalyanixraut picture kalyanixraut  ·  3Comments

AnthumChris picture AnthumChris  ·  3Comments

JordanWSmith15 picture JordanWSmith15  ·  3Comments