This is my code <html> <form action='../biopydb/new.php' method='post'> <?php $Pathway_Name = $_COOKIE['pathwayname']; $dir1 ="../biopydb/Pathway_Images/"."$Pathway_Name/"; $dirPath = dir($dir1); $imgArray = array(); while (($file = $dirPath->read()) !== false) { if ((substr($file, -3)=="gif") || (substr($file, -3)=="jpg") || (substr($file, -3)=="png")) { $imgArray[ ] = trim($file); } } sort($imgArray); $c = count($imgArray); for($i=0; $i<$c; $i++) { $value = "$dir1"."$imgArray[$i]"; echo "<input type='radio' name='group1' value='$value' /> $imgArray[$i] <br/>"; } ?> <br/><br/> <center> <input type='submit' value='Download'/></center> </form> </html> new.php <?php $Pathway_Name = $_COOKIE['pathwayname']; $dir1 ="../biopydb/Pathway_Images/"."$Pathway_Name/"; $filename = $_POST["group1"]; echo"$filename"; header("Content-Disposition: attachment; filename=\"" . basename($filename) . "\""); header("Content-Type: application/force-download"); header("Content-Length: " . filesize($filename)); header("Connection: close"); ?>
Ads