티스토리 뷰

<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/

이걸 사용하라고 나와 있었다.

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
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
글 보관함