 |
|
|  |
PHP °£´ÜÇÑ ÆÄÀÏ ¾÷·Îµå(upload) ¿¹Á¦ |
|
|
 |
13³â Àü |
php¸¦ ÀÌ¿ëÇؼ ÆÄÀÏ ÇÑ°³¸¦ ¾÷·Îµå ÇÏ´Â °£´ÜÇÑ ¿¹Á¦ÀÔ´Ï´Ù. ¿¹Á¦°¡ ³Ê¹« °£´ÜÇϹǷΠºÎ¿¬¼³¸íÀº ÇÇÇϵµ·Ï ÇÏ°Ú½À´Ï´Ù. ´Ü ¾÷·Îµå¸¦ ´ã´çÇÏ´Â uptest.html°ú uptest_end.php °¡ ÀÖ´Â µð·ºÅ丮¿¡ upload¶õ Æú´õ¸¦ ¸¸µé¾î ÁÖ¼Å¾ß ÇÕ´Ï´Ù.
±×¸®°í Æ۹̼ÇÀº 707·Î ÁÖ½Ã¸é µË´Ï´Ù.
º¸³»´Â ÆÄÀÏ(uptest.html) <html>
<head>
<title>°£´Ü¾÷·Îµå</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</head>
<body>
<table width="550" border="0" cellspacing="0" cellpadding="0">
<tr>
<form name="upform" method="POST" enctype="multipart/form-data" action="uptest_end.php">
<td width="78" align="center"> ÆÄÀÏ</td>
<td width="390"> <input type="file" name="upfile" size="38"></td>
<td width="82"> <input type="submit" name="Submit" value="Àü¼Û"></td>
</form>
</tr>
</table>
</body>
</html>
¾÷·Îµå ÆÄÀÏÀ» ó¸®ÇÏ´Â ÆÄÀÏ(uptest_end.php) <?php
$upfile_ext=substr(strrchr($upfile_name,"."),1); //ÆÄÀÏÈ®ÀåÀÚ¸¦ ±¸ÇÑ´Ù
if(eregi("php|cgi|exe|jsp|asp|aspx", $upfile_ext)){ //ÆÄÀÏÈ®ÀåÀÚ¸¦ üũÇÏ¿© ¾÷·Îµå¸¦ Á¦ÇÑÇÑ´Ù
echo"<script type='text/javascript'>alert('ÆÄÀÏ ¾÷·Îµå°¡ Á¦ÇÑµÈ ÆÄÀÏÀÔ´Ï´Ù.');history.go(-1);</script>";
exit;
}
echo"ÆÄÀϸí:".$upfile_name."<br>";
echo"ÀÓ½ÃÆÄÀϸí:".$upfile."<br>";
echo"ÆÄÀÏÅ©±â:".$upfile_size."<br>";
echo"ÆÄÀÏŸÀÔ:".$upfile_type."<br>";
echo"ÆÄÀÏÈ®ÀåÀÚ:".$upfile_ext."<br>";
if(copy($upfile,"upload/".$upfile_name)){
echo"<strong>¾÷·Îµå¼º°ø</strong>";
} else {
echo"<strong>¾÷·Îµå½ÇÆÐ</strong>";
}
?>
|
|
̵̧ : 482 |
̵̧
¸ñ·Ï
|
|
|  |
|