How to limit file upload to only images with HTML?

Spread the love

Sometimes, we want to limit file upload to only images with HTML.

In this article, we’ll look at how to limit file upload to only images with HTML.

How to limit file upload to only images with HTML?

To limit file upload to only images with HTML, we set the accept attribute.

For instance,m we write

<input type="file" multiple accept="image/*,audio/*,video/*" />

to set the accept attribute to the list of file types accepted by the file input.

Conclusion

To limit file upload to only images with HTML, we set the accept attribute.

Leave a Reply

Your email address will not be published.