<input type="file" name="image" class="form-control input-sm" style="float: left; width: 80%;" accept="image/jpeg" onchange="checkFileData(this);"/>
function checkFileData(el){
if(!/\.(jpeg|jpg)$/i.test(el.value)){
alert('jpg 파일만 업로드 가능합니다.');
el.value = '';
el.focus();
}
}
응용하면됨
댓글