From d4f31f1749c241382cca653d7cfe50721fcd6982 Mon Sep 17 00:00:00 2001 From: netpro2k <netpro2k@gmail.com> Date: Mon, 6 Aug 2018 17:07:48 -0700 Subject: [PATCH] Fix issue when selecting the same file after clearing --- src/react-components/create-object-dialog.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/react-components/create-object-dialog.js b/src/react-components/create-object-dialog.js index 145fda144..364bd46b2 100644 --- a/src/react-components/create-object-dialog.js +++ b/src/react-components/create-object-dialog.js @@ -84,6 +84,7 @@ export default class CreateObjectDialog extends Component { file: null, fileName: "" }); + this.fileInput.value = null; }; render() { @@ -112,7 +113,13 @@ export default class CreateObjectDialog extends Component { {isMobile ? mobileInstructions : desktopInstructions} <form onSubmit={this.onCreateClicked}> <div className={styles.addMediaForm}> - <input id={fileInputId} className={styles.hideFileInput} type="file" onChange={this.onFileChange} /> + <input + id={fileInputId} + ref={f => (this.fileInput = f)} + className={styles.hideFileInput} + type="file" + onChange={this.onFileChange} + /> <div className={styles.inputBorder}> {this.state.file ? filenameLabel : urlInput} {this.state.url || this.state.fileName ? cancelButton : uploadButton} -- GitLab