<script>
function fileCheck() {
var chk = true;
var str = document.inputForm.FILE_PATH.value;
var ext = str.substring(str.lastIndexOf(".")+1, str.length);
var file_Name = str.substring(str.lastIndexOf("\")+1, str.length);
if (ext == "csv"){
document.inputForm.FILE_NM.value=file_Name;
document.inputForm.TMP_FILE_PATH.value=str;
chk = true;
} else {
alert("파일의 확장자가 csv만 가능합니다.");
document.inputForm.reset(); //file 경로 리셋...
chk = false;
}
return chk;
}
</script>
//파일찾기...라는 버튼없이 깔끔하게 처리 하는방법
<input type="text" name="TMP_FILE_PATH" class="form01" style="width:360px" readonly onClick="document.inputForm.FILE_PATH.click()">
<a href="javascript:;" onClick="document.inputForm.FILE_PATH.click()">파일선택(이미지)</a>
<input type="file" name="FILE_PATH" style="display:none" onchange="fileCheck();"> |
|
|