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

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

<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,800
JavaScript 16-01-19 조회 2,833
PHP 16-01-18 조회 3,202
웹서버 16-01-18 조회 3,330
JavaScript 16-01-18 조회 4,492
jQuery 16-01-18 조회 7,159
PHP 16-01-17 조회 3,922
웹서버 16-01-17 조회 3,313
웹서버 16-01-17 조회 5,506
JavaScript 16-01-16 조회 4,243
JavaScript 16-01-16 조회 3,421
JavaScript 16-01-16 조회 2,463
JavaScript 16-01-15 조회 5,307
JavaScript 16-01-15 조회 3,316
JavaScript 16-01-15 조회 3,085
JavaScript 16-01-15 조회 4,196
PHP 16-01-14 조회 3,728
MySQL 16-01-14 조회 1.3만
JavaScript 16-01-14 조회 2,924
JavaScript 16-01-14 조회 4,460
JavaScript 16-01-14 조회 3,302
PHP 16-01-13 조회 5,838
MySQL 16-01-13 조회 5,077
JavaScript 16-01-13 조회 3,742
JavaScript 16-01-13 조회 4,713
JavaScript 16-01-13 조회 3,380
PHP 16-01-12 조회 4,027
PHP 16-01-12 조회 3,547
JavaScript 16-01-12 조회 2,641
MySQL 16-01-12 조회 4,095