Add support for client certificates
This commit is contained in:
parent
d9b63dd0ef
commit
937560e859
20 changed files with 376 additions and 39 deletions
30
client/src/js/components/FileInput.js
Normal file
30
client/src/js/components/FileInput.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
import React, { Component } from 'react';
|
||||
import pure from 'pure-render-decorator';
|
||||
|
||||
@pure
|
||||
export default class FileInput extends Component {
|
||||
componentWillMount() {
|
||||
this.input = window.document.createElement('input');
|
||||
this.input.setAttribute('type', 'file');
|
||||
|
||||
this.input.addEventListener('change', e => {
|
||||
const file = e.target.files[0];
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = () => {
|
||||
console.log(reader.result.byteLength);
|
||||
this.props.onChange(file.name, reader.result);
|
||||
};
|
||||
|
||||
reader.readAsArrayBuffer(file);
|
||||
});
|
||||
}
|
||||
|
||||
handleClick = () => this.input.click();
|
||||
|
||||
render() {
|
||||
return (
|
||||
<button className="input-file" onClick={this.handleClick}>{this.props.name}</button>
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue