Display the image in input file from db in at the same time if i change the choosen file then that image will preview
Choosen Image preview in react js
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Display the image in input file from db in at the same time if i change the choosen file then that image will preview
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vaibhav ChauhanRank #963 · 2.1K reputationPosted Jul 8, 2021, 8:25 AM EDT
May be this can help you:
const React = require('react') class Upload extends React.Component { constructor(props){ super(props) this.state = { file: null } this.handleChange = this.handleChange.bind(this) } handleChange(event) { this.setState({ file: URL.createObjectURL(event.target.files[0]) }) } render() { return ( ); } } module.exports = UploadReference:
https://medium.com/@650egor/react-30-day-challenge-day-2-image-upload-preview-2d534f8eaaa