ȸ¿ø¾ÆÀÌÄÜÀ» gif·Î¸¸ µî·Ï°¡´É ÇÕ´Ï´Ù. ÀÌ°ÍÀ» bmp, jpg, pngµµ °¡´ÉÇÏ°Ô ÇØÁÝ´Ï´Ù.
¼ºñ½º ÆÁÀ¸·Î ±½Àº »¡°£»ö ºÎºÐÀ» Ãß°¡ÇÏ¸é ¾ÆÀÌÄÜ ÆÄÀÏÀÇ ¿ë·®ÀÌ Å¬¶§ °æ°í ¸Þ½ÃÁö
º¸³»ÁÝ´Ï´Ù. ÁüÀÛÇϽðÚÁö¸¸ alert¸¦ µÎ¹ø º¸³» ÁÝ´Ï´Ù. À̺κÐÀº ¿øº» ¿À·ùÀΰŰ°Àºµ¥ ¼öÁ¤¾ÈÇß¾î¿ä.
/skin/member/basic/register_form.skin.php¿¡¼
if (typeof f.mb_icon != 'undefined') {
if (f.mb_icon.value) {
if (!f.mb_icon.value.toLowerCase().match(/.(gif|bmp|jpg|png)$/i)) {
alert('ȸ¿ø¾ÆÀÌÄÜÀÌ gif|jpg|bmp|png ÆÄÀÏÀÌ ¾Æ´Õ´Ï´Ù.');
f.mb_icon.activate();
return;
}
}
}
/bbs/register_form_update.php¿¡¼
// ¾ÆÀÌÄÜ ¾÷·Îµå
if (is_uploaded_file($_FILES[mb_icon][tmp_name]))
{
//if (preg_match("/(\.gif)$/i", $_FILES[mb_icon][name]))
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $_FILES[mb_icon][name]))
{
// ¾ÆÀÌÄÜ ¿ë·®ÀÌ ¼³Á¤°ªº¸´Ù ÀÌÇϸ¸ ¾÷·Îµå °¡´É
if ($_FILES[mb_icon][size] <= $config[cf_member_icon_size])
{
@mkdir($mb_dir, 0707);
@chmod($mb_dir, 0707);
$dest_path = "$mb_dir/$mb_id.gif";
move_uploaded_file($_FILES[mb_icon][tmp_name], $dest_path);
chmod($dest_path, 0606);
if (file_exists($dest_path))
{
$size = getimagesize($dest_path);
// ¾ÆÀÌÄÜÀÇ Æø ¶Ç´Â ³ôÀÌ°¡ ¼³Á¤°ª º¸´Ù Å©´Ù¸é ÀÌ¹Ì ¾÷·Îµå µÈ ¾ÆÀÌÄÜ »èÁ¦
if ($size[0] > $config[cf_member_icon_width] || $size[1] > $config[cf_member_icon_height])
@unlink($dest_path);
}
} else
{
$msg = "$_FILES[mb_icon][name]} ÆÄÀÏÀÇ ¿ë·®ÀÌ " . number_format($config[cf_member_icon_size]/1000) . "k ¹ÙÀÌÆ®º¸´Ù Å©¹Ç·Î ¾÷·Îµå ÇÒ ¼ö ¾ø½À´Ï´Ù.\\n";
}
}
else
$msg .= $_FILES[mb_icon][name] . "Àº(´Â) gif/jpg/bmp/png ÆÄÀÏÀÌ ¾Æ´Õ´Ï´Ù.";
}
Ãâó : http://www.opencode.co.kr/bbs/board.php?bo_table=gnu4_tips&wr_id=298&page=9