<form action="/statics/demosource/demo-form.php" accept="image/gif, image/jpeg"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> Your image: <input type="file" name="pic" id="pic"><br> <input type="submit" value="提交"> </form> <p><b>注意:</b>几乎所有的主流浏览器都不支持 accept 属性。</p>