특정 파일형태만 업로드 하기 입니다.

· 2016-01-15 (금) 00:16:46 · 3306

<HTML>
<HEAD>
<META NAME="Author" CONTENT="JASKO">

<SCRIPT LANGUAGE="JavaScript">
<!--
extArray = new Array(".gif", ".jpg", ".png");
function LimitAttach(form, file) {
allowSubmit = false;
if (!file) return;
while (file.indexOf("") != -1)
file = file.slice(file.indexOf("") + 1);
ext = file.slice(file.indexOf(".")).toLowerCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray[i] == ext) { allowSubmit = true; break; }
}
if (allowSubmit) form.submit();
else
alert("아래 형태의 파일만 업로드 할 수 있습니다:  "
+ (extArray.join("  ")) + "n다시 선택 해 주세요");
}
//-->
</script>

</HEAD>

<BODY>

<center>
아래 파일들만 업로드 할 수 있습니다
<script>
document.write(extArray.join("  "));
</script>
<p>

<form method=post name=upform action="../../result,html" enctype="multipart/form-data">
 <input type=file name=uploadfile>
<p>
<input type=button name="Submit" value=" 전송 " onclick="LimitAttach(this.form, this.form.uploadfile.value)">
 </form>


</center>

</BODY>
</HTML>

|
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
PHP 16-01-19 조회 3,787
JavaScript 16-01-19 조회 2,826
PHP 16-01-18 조회 3,194
웹서버 16-01-18 조회 3,317
JavaScript 16-01-18 조회 4,483
jQuery 16-01-18 조회 7,146
PHP 16-01-17 조회 3,909
웹서버 16-01-17 조회 3,306
웹서버 16-01-17 조회 5,494
JavaScript 16-01-16 조회 4,235
JavaScript 16-01-16 조회 3,416
JavaScript 16-01-16 조회 2,452
JavaScript 16-01-15 조회 5,294
JavaScript 16-01-15 조회 3,307
JavaScript 16-01-15 조회 3,073
JavaScript 16-01-15 조회 4,184
PHP 16-01-14 조회 3,717
MySQL 16-01-14 조회 1.3만
JavaScript 16-01-14 조회 2,915
JavaScript 16-01-14 조회 4,451
JavaScript 16-01-14 조회 3,291
PHP 16-01-13 조회 5,822
MySQL 16-01-13 조회 5,064
JavaScript 16-01-13 조회 3,734
JavaScript 16-01-13 조회 4,704
JavaScript 16-01-13 조회 3,375
PHP 16-01-12 조회 4,017
PHP 16-01-12 조회 3,538
JavaScript 16-01-12 조회 2,629
MySQL 16-01-12 조회 4,078