此代码中的哪一部分导致整个系统滞后?我正在尝试上传.csv文件并将其显示在同一页面上。此外,当我的输入类型为" file"?时,有没有办法让用户只使用HTML浏览.csv文件? accept=".csv"
无效!
<?php
//code
if (move_uploaded_file($_FILES["file"]["tmp_name"],$target_file)) {
$csvfile=$target_file;
$successful="The file ". basename( $_FILES["file"]["name"]). " has been uploaded.";
//html
echo "<html><body><table>\n\n";
$f = fopen("$csvfile", "r");
while (($line = fgetcsv($f)) !== false) {
echo "<tr>";
foreach ($line as $cell) {
echo "<td>" . htmlspecialchars($cell) . "</td>";
}
echo "</tr>\n";
}
}
fclose($f);
?>