Skip to content

Commit

Permalink
파일 업로드 개수 체크 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
chicpro committed May 3, 2016
1 parent 30815f7 commit 624e3d7
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 8 deletions.
2 changes: 2 additions & 0 deletions bbs/write.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@

if ($w == '') {
$password_required = 'required';
$file = array('count'=>$file_count);
} else if ($w == 'u') {
$password_required = '';

Expand Down Expand Up @@ -348,6 +349,7 @@
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']);
Expand Down
18 changes: 18 additions & 0 deletions bbs/write_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,24 @@
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);
Expand Down
2 changes: 1 addition & 1 deletion mobile/skin/board/basic/write.skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
</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>
Expand Down
2 changes: 1 addition & 1 deletion mobile/skin/board/gallery/write.skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
</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>
Expand Down
2 changes: 1 addition & 1 deletion skin/board/basic/write.skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
</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>
Expand Down
2 changes: 1 addition & 1 deletion skin/board/gallery/write.skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
</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>
Expand Down
2 changes: 1 addition & 1 deletion theme/basic/mobile/skin/board/basic/write.skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
</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>
Expand Down
2 changes: 1 addition & 1 deletion theme/basic/mobile/skin/board/gallery/write.skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
</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>
Expand Down
2 changes: 1 addition & 1 deletion theme/basic/skin/board/basic/write.skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
</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>
Expand Down
2 changes: 1 addition & 1 deletion theme/basic/skin/board/gallery/write.skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
</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>
Expand Down

0 comments on commit 624e3d7

Please sign in to comment.