티스토리 뷰
<form action="./itemexcelupdate_ing.php" method="post" enctype="multipart/form-data">
<input type="file" name="filepath" id="filepath"/></td><td>
<input type="submit" name="SubmitButton"/>
</form>
위에 처럼 form html 을 만들고
action 이 itemexcelupdate_ing.php로 되어 있으니 아래처럼 만든다.
<?
if(isset($_POST['SubmitButton'])){
$target_dir = 'uploads/';
if( !is_dir($target_dir)){
mkdir($target_dir);
}
print_r( $_FILES["filepath"] );
$target_file = $target_dir. basename($_FILES["filepath"]["name"]);
echo "target_file=".$target_file;
move_uploaded_file($_FILES["filepath"]["tmp_name"], $target_file);
include_once('./Excel/reader.php');
$data = new Spreadsheet_Excel_Reader();
// Set output Encoding.
$data->setOutputEncoding('UTF-8');
$data->read($target_file);
}
?>
엑셀 확장자를 xlsx로 하니 아래처럼 에러 났다.
The filename uploads/test.xlsx is not readable.
인터넷 찾아보니 xlsx를 사용하려면
+ PHPExcel
- http://phpexcel.codeplex.com/
이걸 사용하라고 나와 있었다.
'php' 카테고리의 다른 글
[PHP] phpExcelReader 사용중 Fatal error: Uncaught Error: Class 'OLERead' not found in C:\AutoSet10\server\bin\reader.php:265 (0) | 2017.12.12 |
---|---|
[PHP] Parse error: syntax error, unexpected 'new' (T_NEW) in C:\AutoSet10\server\bin\reader.php on line 532 (0) | 2017.12.12 |
php 파일 업로드 (0) | 2017.12.11 |
php 엑셀 excel 업로드 - phpExcelReader oleread.php (0) | 2017.12.11 |
php 파일명 줄(라인) 번호 로그 출력하는 방법 (0) | 2017.12.01 |
- Total
- Today
- Yesterday
- 프로씨
- 자바
- 자바 셀레니움
- 이클립스
- ocpjp
- 파이썬
- MySQL
- ocajp
- 포인터
- 오라클
- 자바 smtp
- 파싱
- C
- JDBC
- 문자열
- esql
- XE
- proc
- 인포믹스
- XE3
- webix
- 스크래핑
- C언어
- KG
- Python
- php
- xe addon
- xe애드온
- ocjap
- EC
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |