<script type="text/javascript">
$(function(){
$("#uploadFile").on("change",fileSelected);
function fileSelected(e){
let files = e.target.files;
let fileArr = Array.prototype.slice.call(files);
fileArr.forEach(function(f){
if(!f.type.match("image.*")){
alert("이미지 확장자만 가능합니다.");
return;
}
let reader = new FileReader();
reader.onload = function(e){
$("#atchFileId").attr("src",e.target.result);
}
reader.readAsDataURL(f);
});
}
});
</script>
<form name="frm"
action="/instrs/createPost?${_csrf.parameterName}=${_csrf.token}"
method="post" enctype="multipart/form-data">
<sec:csrfInput />
</form>