有人可以告诉我如何在PHP中使用html 获取文件路径吗?如何在PHP中的html 中获取文件路径?
这里是我的代码:
index.php
和csv_to_database.php
if (isset($_GET['csv_file'])) {
$row = 1;
if (($handle = fopen($_GET['csv_file'], "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
echo "
$num fields in line $row:
\n";$row++;
for ($c=0; $c < $num; $c++) {
echo $data[$c] . "
\n";
}
}
fclose($handle);
}
}
?>
我的问题是,当CSV数据处于相同它只目录作为我的PHP文件。我想我需要获取文件路径,但我不知道该怎么做。
+0
http://php.net/manual/en/features.file-upload.php –
2011-04-28 05:51:39