浏览目录并获取其路径

I want to have a export button in my page which will save a file onto the user computer. How can I ask the user to where to save the file? The button will open a explore/browse window and the user will select a folder, where to save it.

Like the CBroe said, the browser handles the part about where to save it.

First create a php script (download.php) that gets the data you want, and writes it to, say export.csv.

<h2>Export</h2>
<p><a href="export.php">Download export</a></p>

<?php
//includes here

$fh = fopen( 'export.csv', 'w' );
fclose($fh);
$fp = fopen("export.csv", "w");
$line ="colm1,colm2,colm3";
$line .= "
";
fputs($fp, $line);

// Do some sql and fputs it to the file or what you want here
?>

In another file, export.php you could add:

<?php
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="export.csv"');
include('export.csv');
?>

Now visit download.php and click the link.. it should now ask you to download the file you created in the export script.

Edit: I recommend improving the code by giving the export.csv file an unique name.