Closed stanjdev closed 4 years ago
File is saved here: event.target.files[0] -- use this in onFileChange function
<input
name="logo"
type="file"
onChange={onFileChange}
/>
<div>
{globalState.logo ? <img src={URL.createObjectURL(globalState.logo)} height="175" onLoad={URL.revokeObjectURL(this)}/> : null}
</div>
Upload and the manipulate the file or image using File API: https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications
https://www.geeksforgeeks.org/file-uploading-in-react-js/
https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL
<input type="file"/>
https://reactjs.org/docs/forms.html "file input tag"