How to make HTML file input accept CSV?

Spread the love

Sometimes, we want to make HTML file input accept CSV.

In this article, we’ll look at how to make HTML file input accept CSV.

How to make HTML file input accept CSV?

To make HTML file input accept CSV, we set the accept attribute to .csv.

For instance, we write

<input type="file" accept=".csv" />

to add a file input that only accepts csv files by setting the accept attribute to .csv.

Conclusion

To make HTML file input accept CSV, we set the accept attribute to .csv.

Leave a Reply

Your email address will not be published. Required fields are marked *