/**글쓰는 페이지**/
<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년 전
감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8030 | 9년 전 | 356 | ||
| 8029 | 9년 전 | 293 | ||
| 8028 | 9년 전 | 255 | ||
| 8027 | 9년 전 | 270 | ||
| 8026 | 9년 전 | 320 | ||
| 8025 | 9년 전 | 371 | ||
| 8024 | 9년 전 | 337 | ||
| 8023 | 9년 전 | 383 | ||
| 8022 | 9년 전 | 311 | ||
| 8021 | 9년 전 | 323 | ||
| 8020 | 9년 전 | 311 | ||
| 8019 | 9년 전 | 336 | ||
| 8018 | 9년 전 | 440 | ||
| 8017 | 9년 전 | 532 | ||
| 8016 | 9년 전 | 320 | ||
| 8015 | 9년 전 | 383 | ||
| 8014 | 9년 전 | 318 | ||
| 8013 | 9년 전 | 230 | ||
| 8012 | 9년 전 | 238 | ||
| 8011 | 9년 전 | 440 | ||
| 8010 | 9년 전 | 293 | ||
| 8009 | 9년 전 | 275 | ||
| 8008 | 9년 전 | 281 | ||
| 8007 | 9년 전 | 422 | ||
| 8006 | 9년 전 | 457 | ||
| 8005 |
|
9년 전 | 962 | |
| 8004 | 9년 전 | 345 | ||
| 8003 | 9년 전 | 413 | ||
| 8002 | 9년 전 | 320 | ||
| 8001 |
|
9년 전 | 663 | |
| 8000 | 9년 전 | 409 | ||
| 7999 | 9년 전 | 367 | ||
| 7998 | 9년 전 | 420 | ||
| 7997 | 9년 전 | 304 | ||
| 7996 | 9년 전 | 530 | ||
| 7995 | 9년 전 | 451 | ||
| 7994 | 9년 전 | 318 | ||
| 7993 | 9년 전 | 378 | ||
| 7992 | 9년 전 | 502 | ||
| 7991 | 9년 전 | 244 | ||
| 7990 | 9년 전 | 267 | ||
| 7989 | 9년 전 | 295 | ||
| 7988 | 9년 전 | 720 | ||
| 7987 | 9년 전 | 416 | ||
| 7986 | 9년 전 | 406 | ||
| 7985 | 9년 전 | 504 | ||
| 7984 | 9년 전 | 425 | ||
| 7983 | 9년 전 | 654 | ||
| 7982 | 9년 전 | 506 | ||
| 7981 | 9년 전 | 460 | ||
| 7980 | 9년 전 | 486 | ||
| 7979 | 9년 전 | 455 | ||
| 7978 | 9년 전 | 439 | ||
| 7977 | 9년 전 | 378 | ||
| 7976 | 9년 전 | 844 | ||
| 7975 | 9년 전 | 355 | ||
| 7974 | 9년 전 | 386 | ||
| 7973 | 9년 전 | 588 | ||
| 7972 | 9년 전 | 374 | ||
| 7971 | 9년 전 | 452 | ||
| 7970 | 9년 전 | 288 | ||
| 7969 | 9년 전 | 536 | ||
| 7968 | 9년 전 | 377 | ||
| 7967 | 9년 전 | 360 | ||
| 7966 | 9년 전 | 364 | ||
| 7965 |
|
9년 전 | 1007 | |
| 7964 | 9년 전 | 395 | ||
| 7963 | 9년 전 | 386 | ||
| 7962 | 9년 전 | 364 | ||
| 7961 |
전갈자리남자
|
9년 전 | 502 | |
| 7960 | 9년 전 | 955 | ||
| 7959 | 9년 전 | 547 | ||
| 7958 | 9년 전 | 401 | ||
| 7957 | 9년 전 | 361 | ||
| 7956 | 9년 전 | 365 | ||
| 7955 | 9년 전 | 442 | ||
| 7954 | 9년 전 | 367 | ||
| 7953 | 9년 전 | 421 | ||
| 7952 | 9년 전 | 347 | ||
| 7951 | 9년 전 | 495 | ||
| 7950 | 9년 전 | 381 | ||
| 7949 | 9년 전 | 382 | ||
| 7948 | 9년 전 | 321 | ||
| 7947 | 9년 전 | 926 | ||
| 7946 | 9년 전 | 421 | ||
| 7945 | 9년 전 | 386 | ||
| 7944 | 9년 전 | 411 | ||
| 7943 | 9년 전 | 365 | ||
| 7942 | 9년 전 | 400 | ||
| 7941 | 9년 전 | 382 | ||
| 7940 | 9년 전 | 873 | ||
| 7939 | 9년 전 | 346 | ||
| 7938 | 9년 전 | 374 | ||
| 7937 | 9년 전 | 272 | ||
| 7936 | 9년 전 | 875 | ||
| 7935 | 9년 전 | 438 | ||
| 7934 | 9년 전 | 405 | ||
| 7933 | 9년 전 | 499 | ||
| 7932 | 9년 전 | 466 | ||
| 7931 | 9년 전 | 525 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기