0

I have an input that I do not want to accept GIFs for. Is it possible to use the accept attribute to block certain types of files? Thanks for the help!

My current set up looks like this: accept="image/*"

1
  • 1
    You can validate it with simple javascript like in this answer. Of course, you should validate it in server too.. Commented Oct 23, 2017 at 15:09

1 Answer 1

2

Is it possible to use the accept attribute to block certain types of files?

No. The user can still select any file at local filesystem, even when accepts attribute is set. The value at accepts attribute is only a suggestion to the user. You will need to perform additional checks as to the actual file type at client side before posting data to server and, or perform validation at the server.

See also make ASP.Net file upload secure.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the help!

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.