保存文件夹PHP中的文件

I created a filename reader in php that read the files from a folder, now I want to add a function that aloud me to download this file through the webreader, and let me choose wherever I want to save it

I really dont know whats the problem with the script.

any one with an idea ? This is what I have at the moment.

index.php

<?php
$mydir = "images/";
if ($handle = opendir($mydir)) {
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
?>
           <a href="download.php?f=<?php echo $file ?>" target="_blank"><?php echo $file ?></a>
<?php
        }
    }
    closedir($handle);
}
?>

download.php

<?php $filename = $_GET['f'];
// set this to the path where your zipped files are located
$filepath = "images" . $filename;
// a little security
if(strpos($filename, '..') !== false || realpath($filepath) != $filepath) die();
if (file_exists($filepath)){
    // make sure the browser knows what it's getting, and what to do with it
    header('Cache-Control: public');
    header('Content-Type: application/zip');
    header('Content-Disposition: attachment; filename=' . $filename);
    readfile($filepath);
    die(); 
} else {
    die('Error: File not found.');
}

?>

Try $filepath = "images/" . $filename; instead of $filepath = "images" . $filename;