<?php if ($is_file) { ?>
<style>
#variableFiles { width:100%; margin:0; border:0; }
#variableFiles td { padding:0px 0px 7px; border:0; }
#variableFiles input[type=file] { box-shadow : none; border: 1px solid #ccc !important; outline:none; }
#variableFiles .form-group { margin-left:0; margin-right:0; margin-bottom:7px; }
#variableFiles .checkbox-inline { padding-top:0px; font-weight:normal; }
</style>
<div class="form-group">
<label class="col-sm-2 control-label">첨부파일</label>
<div class="col-sm-10">
<button class="btn btn-sm btn-color" type="button" onclick="add_file();"><i class="fa fa-plus-circle fa-lg"></i> 추가하기</button>
<button class="btn btn-sm btn-black" type="button" onclick="del_file();"><i class="fa fa-times-circle fa-lg"></i> 삭제하기</button>
</div>
</div>
<div class="form-group" style="margin-bottom:0;">
<div class="col-sm-10 col-sm-offset-2">
<table id="variableFiles"></table>
</div>
</div>
<script>
var flen = 0;
function add_file(delete_code) {
var upload_count = <?php echo (int)$board['bo_upload_count']; ?>;
if (upload_count && flen >= upload_count) {
alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
return;
}
var objTbl;
var objNum;
var objRow;
var objCell;
var objContent;
if (document.getElementById)
objTbl = document.getElementById("variableFiles");
else
objTbl = document.all["variableFiles"];
objNum = objTbl.rows.length;
objRow = objTbl.insertRow(objNum);
objCell = objRow.insertCell(0);
objContent = "<div class='row'>";
objContent += "<div class='col-sm-7'><div class='form-group'><div class='input-group input-group-sm'><span class='input-group-addon'>파일 "+objNum+"</span><input type='file' class='form-control input-sm' name='bf_file[]' title='파일 용량 <?php echo $upload_max_filesize; ?> 이하만 업로드 가능'></div></div></div>";
if (delete_code) {
objContent += delete_code;
} else {
<?php if ($is_file_content) { ?>
objContent += "<div class='col-sm-5'><div class='form-group'><input type='text'name='bf_content[]' class='form-control input-sm' placeholder='이미지에 대한 내용을 입력하세요.'></div></div>";
<?php } ?>
;
}
objContent += "</div>";
objCell.innerHTML = objContent;
flen++;
}
<?php echo $file_script; //수정시에 필요한 스크립트?>
function del_file() {
// file_length 이하로는 필드가 삭제되지 않아야 합니다.
var file_length = <?php echo (int)$file_length; ?>;
var objTbl = document.getElementById("variableFiles");
if (objTbl.rows.length - 1 > file_length) {
objTbl.deleteRow(objTbl.rows.length - 1);
flen--;
}
}
</script>
이것은 이번에 업뎃되면서 새로생긴 첨부파일인데요
<?php switch($i){
case '0': $input = "31513몬스터[이미지]"; break;
}
?>
패치전에는 이렇게하면됫엇는데 패치후에는 어떻게적용시키는지모르겠습니다..
답변 2개 / 댓글 3개
해당 게시판 설정 페이지에서 '파일 설명 사용'이라고 된 부분 체크하시면 윗 항목 나옵니다.
혹시 안 나오면 스킨을 다른 걸로 바꿔 보시기 바랍니다.
답변에 대한 댓글 2개
<tr>
<th scope="row">몬스터[이미지]</th>
<td>
<input type="file" name="bf_file[]" title="파일첨부 : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file frm_input">
<?php if ($is_file_content) { ?>
<input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[0]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="frm_file frm_input" size="50">
<?php } ?>
<?php if($w == 'u' && $file[0]['file']) { ?>
<input type="checkbox" id="bf_file_del0" name="bf_file_del[0]" value="1"> <label for="bf_file_del0"><?php echo $file[0]['source'].'('.$file[0]['size'].')'; ?> 파일 삭제</label>
<?php } ?>
</td>
</tr>
[/code]
[0], bf_file_del0으로 된 부분에 있는 숫자들만 순차적으로 늘리시면 됩니다.
이걸로 쭉못쓰나요?
답변에 대한 댓글 1개
지금 예제로 올리신 [이미지], [속성], [위치1] 이것들을 배열에 담아서 추가하기, 삭제하기를 누를 때마다 현재 개수 체크를 해서 뿌리게 하면 되겠네요.
이 부분은 자바스크립트를 찾아 보셔야 하겠네요.
그리고 수정 페이지에서는 php까지 같이 고려를 해야 할 것 같습니다.
답변을 작성하려면 로그인이 필요합니다.
0 1 2 3 4 5 각각 이름을지정해주고싶다는건데 아시나요혹시~~?