Question:
I have file input for image
Answer:
You’re seeing this error because a FileReader‘s readAsDataURL takes a Blob as parameter.You are currently passing it
undefined
(check by running console.log(file)
), because img
is a
File (which is a Blob), and it doesn’t have a files
property.Passing it the file should work:
If you have better answer, please add a comment about this, thank you!