/**글쓰는 페이지**/
<SCRIPT LANGUAGE="JavaScript">
var fNum = 1;
//인덱스로 찾지 않아도 되므로 소스가 복잡하지 않음.
function getObj()
{
var obj = event.srcElement
while (obj.tagName !='TD') //TD가 나올때까지의 Object추출
{
obj = obj.parentElement
}
return obj
}
//맨 아래쪽에 테이블 추가하기 ("최초에 추가"글씨를 눌렀을때 맨아래 추가하기 위한 함수)
function inRowLast()
{
if(fNum > 5000) { return false; } //5000개 까지만 추가를 허용하겠다는 설정입니다.
else {
//웹브라우져에 따른 설정.
//익스플로어일때,
if(document.getElementById){
var Tbl = document.getElementById('tb1');
}
//그외 브라우져일때..
else
{
var Tbl = document.all['tb1'];
}
var tRow = Tbl.insertRow(); //그냥 맨 아래에 추가하므로, 별다른 변수없습니다.
var uploadOBJ = "<table width=\"720\">";
uploadOBJ +="<tr>"
uploadOBJ +="<td class=\"wr_td01\">이미지첨부</td>";
uploadOBJ +="<td class=\"wr_td02\"><input type=\"file\" name=\"fimg[]\" class=\"wr_rec14\"> <img src=\"./img/del.jpg\" onclick='tb1.deleteRow(this.parentNode.parentNode.rowIndex)'><br/>이미지 파일만 등록하세요</td>";
var fNum = 1;
//인덱스로 찾지 않아도 되므로 소스가 복잡하지 않음.
function getObj()
{
var obj = event.srcElement
while (obj.tagName !='TD') //TD가 나올때까지의 Object추출
{
obj = obj.parentElement
}
return obj
}
//맨 아래쪽에 테이블 추가하기 ("최초에 추가"글씨를 눌렀을때 맨아래 추가하기 위한 함수)
function inRowLast()
{
if(fNum > 5000) { return false; } //5000개 까지만 추가를 허용하겠다는 설정입니다.
else {
//웹브라우져에 따른 설정.
//익스플로어일때,
if(document.getElementById){
var Tbl = document.getElementById('tb1');
}
//그외 브라우져일때..
else
{
var Tbl = document.all['tb1'];
}
var tRow = Tbl.insertRow(); //그냥 맨 아래에 추가하므로, 별다른 변수없습니다.
var uploadOBJ = "<table width=\"720\">";
uploadOBJ +="<tr>"
uploadOBJ +="<td class=\"wr_td01\">이미지첨부</td>";
uploadOBJ +="<td class=\"wr_td02\"><input type=\"file\" name=\"fimg[]\" class=\"wr_rec14\"> <img src=\"./img/del.jpg\" onclick='tb1.deleteRow(this.parentNode.parentNode.rowIndex)'><br/>이미지 파일만 등록하세요</td>";
uploadOBJ +="</tr>";
uploadOBJ += " <tr><td colspan='2' class='wr_line'></td></tr>";
uploadOBJ += "</table>";
tRow.insertCell(0).innerHTML = uploadOBJ;
fNum++;
fb_write.num.value=fNum;
}
uploadOBJ += " <tr><td colspan='2' class='wr_line'></td></tr>";
uploadOBJ += "</table>";
tRow.insertCell(0).innerHTML = uploadOBJ;
fNum++;
fb_write.num.value=fNum;
}
}//End of function
</script>
<input type="hidden" name="num" value="1">
<input type="hidden" name="num" value="1">
<tr>
<td class='wr_td01'>이미지첨부</td>
<td class='wr_td02'><input type="file" name="fimg[]" class="wr_rec14"> <img src="./img/add.jpg"onclick='inRowLast();'><br/>이미지 파일만 등록하세요</td>
</tr>
/*받는 페이지*/
/*동적테이블로 등록되는 이미지*/
$num = $_POST['num']; //추가 되는 tr
$fimg=substr(strrchr($_FILES['fimg']['name'],'.'),1);
for($i=0 ; $i<$num ; $i++){
//이미지등록
$ext=substr(strrchr($_FILES['fimg']['name'],'.'),1);
if($ext ==''){
}else{
$fn=date("YmdHis").".".$ext; // 원본파일 이름
$fn2=date("YmdHis")."img".$i.".".$ext;// 리사이징 이름
if(is_uploaded_file($_FILES['fimg']['tmp_name'])==true){
$result=move_uploaded_file($_FILES['fimg']['tmp_name'],$write_path.$fn);
if($result==true){//업로드에 성공하면
$ga_img=$fn;
}
//파일이 정상적으로 업로드되지 않안도 경고처리 하지 않는다.
}
$image = new SimpleImage();
$image->load($write_path.$ga_img); //저장된 원본파일 불러온다.
$ext=substr(strrchr($_FILES['fimg']['name'],'.'),1);
if($ext ==''){
}else{
$fn=date("YmdHis").".".$ext; // 원본파일 이름
$fn2=date("YmdHis")."img".$i.".".$ext;// 리사이징 이름
if(is_uploaded_file($_FILES['fimg']['tmp_name'])==true){
$result=move_uploaded_file($_FILES['fimg']['tmp_name'],$write_path.$fn);
if($result==true){//업로드에 성공하면
$ga_img=$fn;
}
//파일이 정상적으로 업로드되지 않안도 경고처리 하지 않는다.
}
$image = new SimpleImage();
$image->load($write_path.$ga_img); //저장된 원본파일 불러온다.
/** 원본의 이미지 사이즈를 측정한다... width값만.. **/
$ga_photo_file = $write_path.$ga_img;
$ga_photo_size = @getimagesize($ga_photo_file);
$ga_photo_width = $ga_photo_size[0]; //가로
/** 원본의 이미지 사이즈를 측정한다... width값만.. **/
$ga_photo_file = $write_path.$ga_img;
$ga_photo_size = @getimagesize($ga_photo_file);
$ga_photo_width = $ga_photo_size[0]; //가로
/** 원본의 이미지 사이즈를 측정한다... width값만.. **/
if($ga_photo_width <700){
}else{
$image->resizeToWidth(700); //사이즈 설정 너비값
}
$image->save($write_path.$fn2); //축소한 이미지 등록
//원본파일 삭제
unlink($write_path.$ga_img); //unlink 파일을 삭제
//중요 이미지가 설정 값보다 작을경우에는?? 어떻하지~ 너!!
}
}else{
$image->resizeToWidth(700); //사이즈 설정 너비값
}
$image->save($write_path.$fn2); //축소한 이미지 등록
//원본파일 삭제
unlink($write_path.$ga_img); //unlink 파일을 삭제
//중요 이미지가 설정 값보다 작을경우에는?? 어떻하지~ 너!!
}
/*이미지 등록 시작*/
$write_sql = 'INSERT INTO kj_img(im_fokey,im_img,im_date) VALUES ("'.$fo_key.'","'.$fn2.'","'.$gw_date.'")';
$write_result=mysql_query($write_sql) or die(mysql_error());
}
$write_sql = 'INSERT INTO kj_img(im_fokey,im_img,im_date) VALUES ("'.$fo_key.'","'.$fn2.'","'.$gw_date.'")';
$write_result=mysql_query($write_sql) or die(mysql_error());
}
---->
동적테이블로 값을 전달하여 그걸 받아야 하는데..
일반적인 텍스트는 잘 넘어가고 잘 받아 집니다.
근데.. 이미지는 $_FILES~로 받아야 하는데.. 배열값을 어떻게 받아야 하죠?? 미쳐 버리겠습니다.
세상이 꽉 막힌 기분이네요... ㅠ.ㅠ
아시는분 도와주세요..
댓글 4개
11년 전
youtube 파싱하다 죽을뻔 봤습니다.;;
Video Id cXwZt9tC72A
Title: 프로포즈 샌드 애니메이션 김아름
Thumbnail: https://i.ytimg.com/vi/cXwZt9tC72A/default.jpg
이렇게까지는 얻어 왔습니다.
디비에 집어 넣어야 겠네요 ㅋ;
Video Id cXwZt9tC72A
Title: 프로포즈 샌드 애니메이션 김아름
Thumbnail: https://i.ytimg.com/vi/cXwZt9tC72A/default.jpg
이렇게까지는 얻어 왔습니다.
디비에 집어 넣어야 겠네요 ㅋ;
11년 전
무슨 말씀이죠?
11년 전
아 죄송 .. 저녁에 정신이 없어서 여기다 글을 남겼군요...
$files = $_FILES['fimg'];
foreach($files as $file)
{
$real_file = $file['tmp_name'];
$file_name= $file['name'];
}
이렇게 하시거나.
for($i=0;$i<count($files);$i++)
{
$file = $files[i];
$feal_file = $file['tmp_name'];
$file_name= $file['name'];
}
하시면 됩니다.
파일이 배열로 올때는
$_FILES['fimg'][0]['tmp_name'];
$_FILES['fimg'][1]['tmp_name'];
형태로 오게 됩니다.
$files = $_FILES['fimg'];
foreach($files as $file)
{
$real_file = $file['tmp_name'];
$file_name= $file['name'];
}
이렇게 하시거나.
for($i=0;$i<count($files);$i++)
{
$file = $files[i];
$feal_file = $file['tmp_name'];
$file_name= $file['name'];
}
하시면 됩니다.
파일이 배열로 올때는
$_FILES['fimg'][0]['tmp_name'];
$_FILES['fimg'][1]['tmp_name'];
형태로 오게 됩니다.
11년 전
감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6730 |
|
11년 전 | 1106 | |
| 6729 | 11년 전 | 562 | ||
| 6728 |
|
11년 전 | 575 | |
| 6727 | 11년 전 | 2424 | ||
| 6726 | 11년 전 | 597 | ||
| 6725 |
네모웹에이전시
|
11년 전 | 437 | |
| 6724 |
네모웹에이전시
|
11년 전 | 884 | |
| 6723 | 11년 전 | 1018 | ||
| 6722 | 11년 전 | 960 | ||
| 6721 | 11년 전 | 644 | ||
| 6720 | 11년 전 | 1974 | ||
| 6719 | 11년 전 | 2196 | ||
| 6718 | 11년 전 | 1095 | ||
| 6717 |
|
11년 전 | 653 | |
| 6716 | 11년 전 | 2311 | ||
| 6715 | 11년 전 | 7579 | ||
| 6714 | 11년 전 | 2044 | ||
| 6713 | 11년 전 | 776 | ||
| 6712 |
geektoo
|
11년 전 | 1156 | |
| 6711 | 11년 전 | 896 | ||
| 6710 |
sirzzang
|
11년 전 | 2126 | |
| 6709 |
bewitched
|
11년 전 | 1800 | |
| 6708 |
levin
|
11년 전 | 565 | |
| 6707 | 11년 전 | 768 | ||
| 6706 | 11년 전 | 1789 | ||
| 6705 | 11년 전 | 988 | ||
| 6704 |
|
11년 전 | 752 | |
| 6703 | 11년 전 | 415 | ||
| 6702 | 11년 전 | 1095 | ||
| 6701 | 11년 전 | 804 | ||
| 6700 | 11년 전 | 1719 | ||
| 6699 | 11년 전 | 716 | ||
| 6698 |
이박사친구
|
11년 전 | 726 | |
| 6697 | 11년 전 | 1218 | ||
| 6696 | 11년 전 | 618 | ||
| 6695 |
Header
|
11년 전 | 705 | |
| 6694 | 11년 전 | 1160 | ||
| 6693 |
|
11년 전 | 1106 | |
| 6692 | 11년 전 | 1145 | ||
| 6691 | 11년 전 | 1287 | ||
| 6690 |
|
11년 전 | 715 | |
| 6689 | 11년 전 | 895 | ||
| 6688 | 11년 전 | 930 | ||
| 6687 | 11년 전 | 531 | ||
| 6686 |
RGB255
|
11년 전 | 962 | |
| 6685 |
|
11년 전 | 639 | |
| 6684 | 11년 전 | 716 | ||
| 6683 | 11년 전 | 385 | ||
| 6682 | 11년 전 | 1125 | ||
| 6681 | 11년 전 | 1413 | ||
| 6680 | 11년 전 | 438 | ||
| 6679 |
RGB255
|
11년 전 | 389 | |
| 6678 | 11년 전 | 1347 | ||
| 6677 |
|
11년 전 | 432 | |
| 6676 | 11년 전 | 1012 | ||
| 6675 |
디자이너필이
|
11년 전 | 822 | |
| 6674 | 11년 전 | 1242 | ||
| 6673 | 11년 전 | 1314 | ||
| 6672 | 11년 전 | 6027 | ||
| 6671 | 11년 전 | 1335 | ||
| 6670 |
하프의정령
|
11년 전 | 568 | |
| 6669 | 11년 전 | 412 | ||
| 6668 |
공부하고가겠슴다
|
11년 전 | 446 | |
| 6667 |
하프의정령
|
11년 전 | 546 | |
| 6666 | 11년 전 | 787 | ||
| 6665 | 11년 전 | 1410 | ||
| 6664 | 11년 전 | 924 | ||
| 6663 | 11년 전 | 1146 | ||
| 6662 | 11년 전 | 410 | ||
| 6661 |
basketball
|
11년 전 | 506 | |
| 6660 | 11년 전 | 2506 | ||
| 6659 | 11년 전 | 1608 | ||
| 6658 |
|
11년 전 | 1324 | |
| 6657 |
|
11년 전 | 3152 | |
| 6656 | 11년 전 | 562 | ||
| 6655 |
프로프리랜서
|
12년 전 | 2332 | |
| 6654 |
프로프리랜서
|
12년 전 | 1905 | |
| 6653 |
프로프리랜서
|
12년 전 | 1745 | |
| 6652 |
프로프리랜서
|
12년 전 | 1830 | |
| 6651 |
|
12년 전 | 780 | |
| 6650 | 12년 전 | 1314 | ||
| 6649 | 12년 전 | 1315 | ||
| 6648 | 12년 전 | 809 | ||
| 6647 | 12년 전 | 3159 | ||
| 6646 | 12년 전 | 466 | ||
| 6645 | 12년 전 | 964 | ||
| 6644 |
BBAYOUNG
|
12년 전 | 1374 | |
| 6643 | 12년 전 | 1788 | ||
| 6642 | 12년 전 | 640 | ||
| 6641 | 12년 전 | 1333 | ||
| 6640 | 12년 전 | 705 | ||
| 6639 | 12년 전 | 2318 | ||
| 6638 |
jasmin2
|
12년 전 | 746 | |
| 6637 |
geektoo
|
12년 전 | 441 | |
| 6636 | 12년 전 | 663 | ||
| 6635 |
프로프리랜서
|
12년 전 | 2226 | |
| 6634 |
프로프리랜서
|
12년 전 | 1738 | |
| 6633 |
프로프리랜서
|
12년 전 | 4057 | |
| 6632 |
프로프리랜서
|
12년 전 | 1346 | |
| 6631 |
프로프리랜서
|
12년 전 | 1780 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기