[질문] 파일 찾아보기를 +클릭 없이 처음부터 2개로 나오게... 정보
[질문] 파일 찾아보기를 +클릭 없이 처음부터 2개로 나오게...본문
안녕하세요.
글쓰기를 누르면(write.skin.php) 파일을 업로드 할수 있는 [파일 + -] 에서 처음 1개만 출력되고(업로드 파일을 2개 이상으로 설정) +를 클릭해야만 다음 파일을 업로드 할 수 있는 것으로 알고 있습니다.
이 파일 찾아보기를 글쓰기 상태에서 2개로 출력될 수 있도록 할 수 는 없나요?
기본적으로 2개를 항상 업로드 해야하는데 하나를 선택하고 + 누르고 하다보니 불편해서요.
댓글 전체

write.skin.php 파일 아랫부분을
<? if ($is_file) { ?>
<tr>
<td style='padding-left:20px; height:30px;'><table cellpadding=0 cellspacing=0><tr><td style=" padding-top: 10px;">· 파일 <span onclick="add_file();" style='cursor:pointer; font-family:tahoma; font-size:12pt;'>+</span> <span onclick="del_file();" style='cursor:pointer; font-family:tahoma; font-size:12pt;'>-</span></td></tr></table></td>
<td style='padding:5 0 5 0;'><table id="variableFiles" cellpadding=0 cellspacing=0></table><?// print_r2($file); ?>
<script language="JavaScript">
var flen = 0;
function add_file(delete_code)
{
var upload_count = <?=(int)$board[bo_upload_count]?>;
if (upload_count && flen >= upload_count)
{
alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
return;
}
var objTbl;
var objRow;
var objCell;
if (document.getElementById)
objTbl = document.getElementById("variableFiles");
else
objTbl = document.all["variableFiles"];
objRow = objTbl.insertRow(objTbl.rows.length);
objCell = objRow.insertCell(0);
objCell.innerHTML = "<input type='file' class='field_pub_01' name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'>";
if (delete_code)
objCell.innerHTML += delete_code;
else
{
<? if ($is_file_content) { ?>
objCell.innerHTML += "<br><input type='text' class='field_pub_01' size=50 name='bf_content[]' title='업로드 이미지 파일에 해당 되는 내용을 입력하세요.'>";
<? } ?>
;
}
flen++;
}
<?=$file_script; //수정시에 필요한 스크립트?>
function del_file()
{
// file_length 이하로는 필드가 삭제되지 않아야 합니다.
var file_length = <?=(int)$file_length?>;
var objTbl = document.getElementById("variableFiles");
if (objTbl.rows.length - 1 > file_length)
{
objTbl.deleteRow(objTbl.rows.length - 1);
flen--;
}
}
</script></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
------------------------------------
아래와 같이 수정해 보세요
------------------------------------
<? if ($is_file) { ?>
<tr>
<td style='padding-left:20px; height:30px;'><table cellpadding=0 cellspacing=0>
<tr>
<td style=" padding-top: 10px;">· 사진첨부<span class="style1"></span></td>
</tr>
</table></td>
<td style='padding:5 0 5 0;'><table id="variableFiles" cellpadding=0 cellspacing=0>
</table>
<? if(!$w==u){?>
<input type='file' class=ed size=32 name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'>
<br>
<input type='file' class=ed size=32 name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'>
<br>
<?}elseif($w==u){?>
<script language="JavaScript">
var flen = 0;
function add_file(delete_code)
{
var upload_count = <?=(int)$board[bo_upload_count]?>;
if (upload_count && flen >= upload_count)
{
alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
return;
}
var objTbl;
var objRow;
var objCell;
if (document.getElementById)
objTbl = document.getElementById("variableFiles");
else
objTbl = document.all["variableFiles"];
objRow = objTbl.insertRow(objTbl.rows.length);
objCell = objRow.insertCell(0);
objCell.innerHTML = "<input type='file' <?if(!$w==u){echo "required itemname=사진";}?> class=ed size=32 name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'>";
if (delete_code)
objCell.innerHTML += delete_code;
else
{
<? if ($is_file_content) { ?>
objCell.innerHTML += "<br><input type='text' class=ed size=50 name='bf_content[]' title='업로드 이미지 파일에 해당 되는 내용을 입력하세요.'>";
<? } ?>
;
}
flen++;
}
<?=$file_script; //수정시에 필요한 스크립트?>
function del_file()
{
// file_length 이하로는 필드가 삭제되지 않아야 합니다.
var file_length = <?=(int)$file_length?>;
var objTbl = document.getElementById("variableFiles");
if (objTbl.rows.length - 1 > file_length)
{
objTbl.deleteRow(objTbl.rows.length - 1);
flen--;
}
}
</script>
<br>
<span onClick="add_file();" style='cursor:pointer; font-family:tahoma; font-size:9pt;'><blink>파일을 추가로 업로드 하려면 클릭하세요</blink></span> <span onClick="del_file();" style='cursor:pointer; font-family:tahoma; font-size:12pt;'></span>
<? }?></td>
</tr>
<tr>
<td colspan=2 height=1 bgcolor=#e7e7e7></td>
</tr>
<? } ?>
<? if ($is_file) { ?>
<tr>
<td style='padding-left:20px; height:30px;'><table cellpadding=0 cellspacing=0><tr><td style=" padding-top: 10px;">· 파일 <span onclick="add_file();" style='cursor:pointer; font-family:tahoma; font-size:12pt;'>+</span> <span onclick="del_file();" style='cursor:pointer; font-family:tahoma; font-size:12pt;'>-</span></td></tr></table></td>
<td style='padding:5 0 5 0;'><table id="variableFiles" cellpadding=0 cellspacing=0></table><?// print_r2($file); ?>
<script language="JavaScript">
var flen = 0;
function add_file(delete_code)
{
var upload_count = <?=(int)$board[bo_upload_count]?>;
if (upload_count && flen >= upload_count)
{
alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
return;
}
var objTbl;
var objRow;
var objCell;
if (document.getElementById)
objTbl = document.getElementById("variableFiles");
else
objTbl = document.all["variableFiles"];
objRow = objTbl.insertRow(objTbl.rows.length);
objCell = objRow.insertCell(0);
objCell.innerHTML = "<input type='file' class='field_pub_01' name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'>";
if (delete_code)
objCell.innerHTML += delete_code;
else
{
<? if ($is_file_content) { ?>
objCell.innerHTML += "<br><input type='text' class='field_pub_01' size=50 name='bf_content[]' title='업로드 이미지 파일에 해당 되는 내용을 입력하세요.'>";
<? } ?>
;
}
flen++;
}
<?=$file_script; //수정시에 필요한 스크립트?>
function del_file()
{
// file_length 이하로는 필드가 삭제되지 않아야 합니다.
var file_length = <?=(int)$file_length?>;
var objTbl = document.getElementById("variableFiles");
if (objTbl.rows.length - 1 > file_length)
{
objTbl.deleteRow(objTbl.rows.length - 1);
flen--;
}
}
</script></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
------------------------------------
아래와 같이 수정해 보세요
------------------------------------
<? if ($is_file) { ?>
<tr>
<td style='padding-left:20px; height:30px;'><table cellpadding=0 cellspacing=0>
<tr>
<td style=" padding-top: 10px;">· 사진첨부<span class="style1"></span></td>
</tr>
</table></td>
<td style='padding:5 0 5 0;'><table id="variableFiles" cellpadding=0 cellspacing=0>
</table>
<? if(!$w==u){?>
<input type='file' class=ed size=32 name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'>
<br>
<input type='file' class=ed size=32 name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'>
<br>
<?}elseif($w==u){?>
<script language="JavaScript">
var flen = 0;
function add_file(delete_code)
{
var upload_count = <?=(int)$board[bo_upload_count]?>;
if (upload_count && flen >= upload_count)
{
alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
return;
}
var objTbl;
var objRow;
var objCell;
if (document.getElementById)
objTbl = document.getElementById("variableFiles");
else
objTbl = document.all["variableFiles"];
objRow = objTbl.insertRow(objTbl.rows.length);
objCell = objRow.insertCell(0);
objCell.innerHTML = "<input type='file' <?if(!$w==u){echo "required itemname=사진";}?> class=ed size=32 name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'>";
if (delete_code)
objCell.innerHTML += delete_code;
else
{
<? if ($is_file_content) { ?>
objCell.innerHTML += "<br><input type='text' class=ed size=50 name='bf_content[]' title='업로드 이미지 파일에 해당 되는 내용을 입력하세요.'>";
<? } ?>
;
}
flen++;
}
<?=$file_script; //수정시에 필요한 스크립트?>
function del_file()
{
// file_length 이하로는 필드가 삭제되지 않아야 합니다.
var file_length = <?=(int)$file_length?>;
var objTbl = document.getElementById("variableFiles");
if (objTbl.rows.length - 1 > file_length)
{
objTbl.deleteRow(objTbl.rows.length - 1);
flen--;
}
}
</script>
<br>
<span onClick="add_file();" style='cursor:pointer; font-family:tahoma; font-size:9pt;'><blink>파일을 추가로 업로드 하려면 클릭하세요</blink></span> <span onClick="del_file();" style='cursor:pointer; font-family:tahoma; font-size:12pt;'></span>
<? }?></td>
</tr>
<tr>
<td colspan=2 height=1 bgcolor=#e7e7e7></td>
</tr>
<? } ?>
write.skin.php 제일 아래에 보시면
<script language="JavaScript">
window.onload=function() {
drawFont();
}
</script>
이렇게 되어있죠.
drawFont(); 밑에줄에 add_file(); 추가하세요.
<script language="JavaScript">
window.onload=function() {
drawFont();
}
</script>
이렇게 되어있죠.
drawFont(); 밑에줄에 add_file(); 추가하세요.
모두 감사합니다.
김영삼님 소스를 수정해서 적용했습니다. ^^
김영삼님 소스를 수정해서 적용했습니다. ^^

김영삼 07-10-30 17:04 218.♡.58.78
write.skin.php 제일 아래에 보시면
<script language="JavaScript">
window.onload=function() {
drawFont();
<?php
if(empty($w))
{
?>
add_file();
<?
}
?>
</script>
김영삼님꺼 소스에 이렇게 하면 수정할때 자바스크립트 경고 창이 안뜰겁니다.
write.skin.php 제일 아래에 보시면
<script language="JavaScript">
window.onload=function() {
drawFont();
<?php
if(empty($w))
{
?>
add_file();
<?
}
?>
</script>
김영삼님꺼 소스에 이렇게 하면 수정할때 자바스크립트 경고 창이 안뜰겁니다.
파일 찾아보기를 +클릭 없이 처음부터 2개로 나오게