파일 업로드시 경로명 추출 > script

본문 바로가기

script

파일 업로드시 경로명 추출

작성일 07-08-22 10:16

페이지 정보

작성자서방님 조회 684회 댓글 0건

본문

<script type="text/javascript">
function test()
{
 var fname = document.getElementById("myfile").value;
 var s = fname.lastIndexOf("\"); // 파일명 시작부분의 자리수 추출
 var dirpath = fname.substring(0, s); // 처음부터 파일명 시작까지가 경로

 alert(dirpath);

}
</script>

<input type="file" name="myfile" size="60" OnChange="test();">

댓글목록

등록된 댓글이 없습니다.

게시물 검색
Copyright © 서방님.kr All rights reserved.
PC 버전으로 보기