테스트 사이트 - 개발 중인 베타 버전입니다

관리자페이지에서 엑셀파일 올리기

· 13년 전 · 1586 · 3
스킨은 basic 이구요

관리자모드(도메인/adm) 특정페이지에서 csv파일이나 txt파일을 업로드 해서

자동으로 데이타베이스에 넣게 하고 싶은데

어떤 방법으로 해야될까요??

초보라 ㅠㅠ 질문이 좀 막연하긴 하지만 도와주세요 부탁드립니다

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 3개

13년 전
<?
$sub_menu = "400100";
include_once("./_common.php");

$g4[title] = "업직종 일괄 업로드";
include_once ("$g4[admin_path]/admin.head.php");

$xls_file = "./Excel/excel.xls";
$today = date('Ymd');
?>
<?
if (file_exists($xls_file)){
require_once './Excel/reader.php';
$data = new Spreadsheet_Excel_Reader();

// 여기 이부분에서 euc-kr 을 넣어 주면 한글을 이용할 수 있다.
$data->setOutputEncoding('utf-8');
$data->read($xls_dir.$xls_file);
//error_reporting(E_ALL ^ E_NOTICE);

for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {

// re data setting start
$code = $data->sheets[0]['cells'][$i][1];
$name = $data->sheets[0]['cells'][$i][2];

// re data setting end
if($code){
if(!eregi("-", $code)){ // 대매뉴인지 분류
$query = "INSERT INTO g4_sector VALUES('', '{$code}', '{$name}', '업직종', '', 'in');";
sql_query($query);
echo "<font color='red'>\"{$name}\"</font> 덤프완료</br>";
echo $query."<br>";
}else{ //중소분류
$query = "INSERT INTO g4_sector VALUES('', '{$code}', '{$name}', '업직종', '', '');";
sql_query($query);
echo "\"{$name}\" <font color='red'>덤프완료</font></br>";
echo $query."<br>";
}
}
} // for end

}else{
echo "<p><font color='red'><b>XLS 파일이 없습니다.</b></font>";
}
?>



<?
include_once ("$g4[admin_path]/admin.tail.php");
?>
13년 전
위에 있는 소스는 예제구요.
oleread.inc 라고 검색하면 관련 php 모듈 찾을수 있습니다.
답변 감사합니다~ 하다가 모르는거 있으면 쪽지 보내도 될까요;;;

게시글 목록

번호 제목
284348
284336
284333
284332
284320
284318
284316
284313
284307
284306
284303
284298
284296
284290
284286
284280
284277
284272
284261
284259