put the selected filename insted of no file choosen :react js

Viewed 64

when ever i choose a file for example image2.jpg i want that no file choosen text to change into the filename

<input type="file"onChange={this.onChange} value={this.state.allValues.BloodReport} />

enter image description here

full code i have put in codesand box

2 Answers

Use it without value property. name will be showed automaically.

<input type="file"onChange={this.onChange} />

Remove value from <input type="file" /> then try !

<input
  style={styles.cutumbuttons}
  type="file"
  style={styles.cutumbuttons}
  name="ultraSound"
  // accept="application/pdf"
  onChange={this.onChange}
//value={this.state.allValues.BloodReport}
/>
Related