728x90 반응형 파일 첨부2 [Javascript] JavaScript) input type="file" UI 커스텀 및 파일명 출력하는법(Multiple) 1. JSP => input file 선언 및 label로 input file 연동 파일 업로드하기 2. CSS => input file을 깔끔하게 커스텀하기위한 CSS 소스 3.JS window.onload=function(){ target=document.getElementById('file'); target.addEventListener('change',function(){ if(target.value.length){ // 파일 첨부인 상태일경우 파일명 출력 var fileList = ""; for(i = 0; i < target.files.length; i++){ fileList += target.files[i].name + ' '; } target2 = document.getElementById.. 2023. 3. 8. [Javascript] 파일 첨부시 해당파일 새창에서 여는 방법 1. JSP 2. JS window.onload=function(){ target=document.getElementById('fileName'); target.addEventListener('change',function(){ if(target.value.length != 0){ // js에서는 파일 경로가 fakePath로 뜨기때문에 URL.create를 사용한다 var path = URL.createObjectURL(target.files[0]); window.open(path); // window.open으로 해당 파일을 새창으로 연다 //location.href(); $('#originName').html(target.files[0].name); }else{ $('#originName').htm.. 2023. 2. 13. 이전 1 다음 728x90 반응형