Skip to content

Commit c4a3315

Browse files
authored
Merge pull request #14 from taina0407/master
Make sure input work if the same file select again
2 parents cb81a57 + 8140e62 commit c4a3315

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ var FileInput = (function (_React$Component) {
125125
onChange: this.handleChange, ref: function (c) {
126126
return _this2._reactFileReaderInput = c;
127127
},
128+
onClick: function () {
129+
_this2._reactFileReaderInput.value = null;
130+
},
128131
style: hiddenInputStyle })),
129132
this.props.children
130133
);

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export default class FileInput extends React.Component {
7575
onClick={this.triggerInput}>
7676
<input {...this.props} children={undefined} type="file"
7777
onChange={this.handleChange} ref={c => this._reactFileReaderInput = c}
78+
onClick={() => {this._reactFileReaderInput.value = null;}}
7879
style={hiddenInputStyle}/>
7980

8081
{this.props.children}

0 commit comments

Comments
 (0)