3

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.

3 Answers 3

5

You can use accept attribute
Try this code

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

Read more here

1
  • 1
    That does not provide the full solution to the question asked.
    – PKCS12
    Sep 15, 2017 at 10:31
1

Use accept attribute with input type file

<input type="file" name="my-file" id="" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" >

0

You can use the accept attribute. Some older browser do not support it, but i think it is not an issue yet

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.