這裏是我的代碼:上傳.xls文件。
<?php
require_once 'Excel/reader.php';
$data = new Spreadsheet_Excel_Reader();
move_uploaded_file($_FILES["file"]["tmp_name"],$_FILES["file"]["name"]);
$data->read($_FILES["file"]["name"]);
error_reporting(E_ALL^E_NOTICE);
echo "<table border='1'>";
echo "<tr><th>First Name</th><th>Middle Name</th><th>Last Name</th><th>Email ID</th></tr>";
for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++)
{
echo "<tr>";
echo "<td>";
echo $data->sheets[0]['cells'][$j+1][1];
echo "</td>";
echo "<td>";
echo $data->sheets[0]['cells'][$j+1][2];
echo "</td>";
echo "<td>";
echo $data->sheets[0]['cells'][$j+1][3];
echo "</td>";
echo "<td>";
echo $data->sheets[0]['cells'][$j+1][4];
echo "</td>";
//echo "<br>";
echo "</tr>";
}
echo "</table>";
?>
在本地主機上運行這很好,但是當我嘗試在服務器上運行它,它表明:
Warning: move_uploaded_file(Book1.xls) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/wingsele/public_html/get.php on line 6
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpufQkcr' to 'Book1.xls' in /home/wingsele/public_html/get.php on line 6
The filename Book1.xls is not readable
我缺少什麼?
請修復您的代碼:再次粘貼,以便沒有空行,並使用「代碼」按鈕正確縮進。 – 2010-08-20 08:42:18