On handling image and then converting into blob
onHandelUpdateProfileUserAvatar = event => {
// const target = event.target; const value = event.target.value;
event.preventDefault();
// console.log("this.state.fileInput", this.state.fileInput,
// this.state.fileInput.files[0]);
var file = this.state.fileInput.files[0];
var fileName = file.name;
var reader = new FileReader();
reader.onload = function (e) {
const s = e.target.result;
localStorage.setItem("src", s);
localStorage.setItem("tempavatar", s);
};
// console.log("SRC", src);
reader.readAsDataURL(file);
this.setState({
imageFileName: fileName,
onImgLoading: true
}, () => {
setTimeout(() => {
this.previewImage();
}, 1000);
});
}