파일 업로드 개수 체크 추가

This commit is contained in:
chicpro
2016-05-03 16:53:52 +09:00
parent 7a8a4fe71d
commit ee35ce9839
10 changed files with 28 additions and 8 deletions

View File

@ -304,6 +304,7 @@ $secret_checked = "";
if ($w == '') {
$password_required = 'required';
$file = array('count'=>$file_count);
} else if ($w == 'u') {
$password_required = '';
@ -348,6 +349,7 @@ if ($w == '') {
for ($i=1; $i<=G5_LINK_COUNT; $i++) {
$write['wr_link'.$i] = get_text($write['wr_link'.$i]);
}
$file = array('count'=>$file_count);
}
set_session('ss_bo_table', $_REQUEST['bo_table']);

View File

@ -410,6 +410,24 @@ if (!$group['gr_use_access'] && $board['bo_read_level'] < 2 && !$secret) {
naver_syndi_ping($bo_table, $wr_id);
}
// 파일개수 체크
$file_count = 0;
$upload_count = count($_FILES['bf_file']['name']);
for ($i=0; $i<$upload_count; $i++) {
if($_FILES['bf_file']['name'][$i] && is_uploaded_file($_FILES['bf_file']['tmp_name'][$i]))
$file_count++;
}
if($w == 'u') {
$file = get_file($bo_table, $wr_id);
if($file_count && (int)$file['count'] > $board['bo_upload_count'])
alert('기존 파일을 삭제하신 후 첨부파일을 '.number_format($board['bo_upload_count']).'개 이하로 업로드 해주십시오.');
} else {
if($file_count > $board['bo_upload_count'])
alert('첨부파일을 '.number_format($board['bo_upload_count']).'개 이하로 업로드 해주십시오.');
}
// 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.)
@mkdir(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION);

View File

@ -129,7 +129,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
</tr>
<?php } ?>
<?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<?php for ($i=0; $is_file && $i<$file['count']; $i++) { ?>
<tr>
<th scope="row">파일 #<?php echo $i+1 ?></th>
<td>

View File

@ -128,7 +128,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
</tr>
<?php } ?>
<?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<?php for ($i=0; $is_file && $i<$file['count']; $i++) { ?>
<tr>
<th scope="row">파일 #<?php echo $i+1 ?></th>
<td>

View File

@ -146,7 +146,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
</tr>
<?php } ?>
<?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<?php for ($i=0; $is_file && $i<$file['count']; $i++) { ?>
<tr>
<th scope="row">파일 #<?php echo $i+1 ?></th>
<td>

View File

@ -146,7 +146,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
</tr>
<?php } ?>
<?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<?php for ($i=0; $is_file && $i<$file['count']; $i++) { ?>
<tr>
<th scope="row">파일 #<?php echo $i+1 ?></th>
<td>

View File

@ -129,7 +129,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
</tr>
<?php } ?>
<?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<?php for ($i=0; $is_file && $i<$file['count']; $i++) { ?>
<tr>
<th scope="row">파일 #<?php echo $i+1 ?></th>
<td>

View File

@ -128,7 +128,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
</tr>
<?php } ?>
<?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<?php for ($i=0; $is_file && $i<$file['count']; $i++) { ?>
<tr>
<th scope="row">파일 #<?php echo $i+1 ?></th>
<td>

View File

@ -146,7 +146,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
</tr>
<?php } ?>
<?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<?php for ($i=0; $is_file && $i<$file['count']; $i++) { ?>
<tr>
<th scope="row">파일 #<?php echo $i+1 ?></th>
<td>

View File

@ -146,7 +146,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
</tr>
<?php } ?>
<?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<?php for ($i=0; $is_file && $i<$file['count']; $i++) { ?>
<tr>
<th scope="row">파일 #<?php echo $i+1 ?></th>
<td>