HTML: How to limit file upload to be only images?
file-upload, html, image, upload
Solution
HTML5 says `<input type="file" accept="image/*">`. Of course, never trust client-side validation: Always check again on the server-side...
Problem
With HTML, how do I limit what kind of filetypes can be uploaded? To easy the user experience, I want to limit file uploads to be only images (jpeg, gif, png). ``` <form method="post" action="..." enctype="multipart/form-data"> <label for="image">Photo</label> <input name="image" type="file" /> </form> ```