Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make input type= file Should accept only .xlsx and filename contain substring

Tags:

html

enter image description here

I want to upload a .xlsx file to my systems with condition that the file name contains a specified string.

For example: I want to upload file whose name contains "Paper", so the file browser should not display files which don't contain "Paper" in their name.

For the example in the photo that I attached in this post, the file 'Order#...' should not be displayed.

How can i do it? Is it possible to implement this idea? thanks.

like image 364
Đoàn Hữu Dụng Avatar asked Oct 28 '25 15:10

Đoàn Hữu Dụng


1 Answers

You can use accept attribute
Try this code

<input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />

Read more here

like image 90
Divyesh Savaliya Avatar answered Oct 31 '25 04:10

Divyesh Savaliya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!