patternjavascriptCritical
Preview an image before it is uploaded
Viewed 0 times
uploadedbeforepreviewimage
Problem
I want to be able to preview a file (image) before it is uploaded. The preview action should be executed all in the browser without using Ajax to upload the image.
How can I do this?
How can I do this?
Solution
imgInp.onchange = evt => {
const [file] = imgInp.files
if (file) {
blah.src = URL.createObjectURL(file)
}
}
Context
Stack Overflow Q#4459379, score: 3375
Revisions (0)
No revisions yet.