Skip to content
Advertisement

display nothing on removing file [closed]

JavaScript
JavaScript

I making a form where I need to upload image & display it & it displayed. But the problem is when I remove the image then also it display the image.

Advertisement

Answer

There is no need of fileReader.readAsDataURL(); in if-else statement. Just if statement is necessary for Previewing image.

The readAsDataURL() method is used to read the contents of the specified Blob or File. Parameter is neccessary in that method. Which is missing in your else statement.

JavaScript
JavaScript
Advertisement