File "download.php"

Full Path: /home/analogde/www/Bookmarks/CHESS_ON/download.php
File size: 1.94 KB
MIME-type: text/html
Charset: utf-8


<?php
/*
<html>
<head>
<title>Download Files</title>
</head>
<body>
<p><a href="abc.csv">Download TEXT file</a></p>
</body>
</html>
*/

 /*$file_name = basename('abc.csv');
      
	  echo "---> " .$file_name; 
	  
	  echo "<br><br>";
	  
	  $url = getcwd() ."/abc.csv";
	  
	  echo $url;
	  
	  echo "<br><br>";
	  
	  echo exec("pwd");*/
	  
	  ////// copie le fichier : source - destination
/*	    $url = 'https://media.geeksforgeeks.org/wp-content/uploads/gfg-40.png';
		$file_name = basename($url); 
		if (file_put_contents($file_name, file_get_contents($url)))
        {
			echo "File downloaded successfully";
		}
		else
		{
			echo "File downloading failed.";
		}
*/	
	
	/*
	$file = 'abc.csv';

if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="'.basename($file).'"');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    readfile($file);
	echo "Yes";
    exit;
}
	*/
	
/*	echo "lulululululu";
	
	$filename = 'gfg-40.png';

if (file_exists($filename)) 
{
	header('Content-Description: File Transfer');
	header('Content-Type: application/octet-stream');
	header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
	header('Expires: 0');
	header('Cache-Control: must-revalidate');
	header('Pragma: public');
	header('Content-Length: ' . filesize($filename));
	readfile($filename);
	//exit;
	
}*/
	
	$dir = "./";

	$allFiles = scandir($dir);
	$files = array_diff($allFiles, array('.', '..')); //To remove . and .. 

	foreach($files as $file)
	{
//		echo "<a href='charge.php?file=".$file."'>".$file."</a><br>";
		
		echo "<a href='charge.php?file=".$file."' title = bien >".$file."</a><br>";

		
	}
	
	echo "zoulou......";
	
?>