여러 파일 업로드를 허용하는 양식을 웹 페이지에 추가했습니다. 나는 입력 <input type="file" name="photo_upload[]" id="photo_upload" multiple="multiple" />
을 추가했다.javascript를 사용하여 작동하도록 html5 기능 비 호환성 경고를받는 방법
브라우저에서 여러 파일 기능을 지원하지 않는 경우에만 표시되는 경고를 추가하려고했습니다. 이 코드를 시도 :
<script type="text/javascript">
var testrange=document.createElement("input")
testrange.setAttribute("multiple", "multiple")
if (testrange.multiple=="multiple"){
document.getElementById('multiple_warning').style.display = 'none';
}
</script>
<div id="multiple_warning" style="background:#FFFF99; border:dashed; border-width:thin;">Sorry, but your browser does not support the multiple file upload feature.<br />
If you have more than one photo to send us, please send it after you recieved your comformation email.</div>
하지만 항상 "multiple_warning"을 표시합니다. 어떻게하면 제대로 작동합니까? 테스트는 항상도 실패한 이유
사용한 브라우저는 무엇입니까? – Hkachhia
이 [예제] (http://stackoverflow.com/questions/8010122/modernizr-just-for-one-quick-check)와 같이 MODERNIZR 라이브러리를 사용할 수 있습니다. – SpecialHias