I'm working on a web page where a user can download a file but only after accepting the license, so I made the process using PHP
to check if the user checked the license and to not reveal the file's URL
, the code works just fine as I wanted (downloading), here is the code :
$fileName = $_GET['AppName'] . " - Setup.exe";
$path = 'JO9E/' . $fileName;
$size = filesize($path);
header('Content-Type: application/octet-stream');
header('Content-Length: ' . $size);
header('Content-Disposition: attachment; filename=' . $fileName);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
$file = @ fopen($path, 'rb');
if($file) {
$_SESSION["TEMP"] = "nO";
fpassthru($file);
echo "<script type='text/javascript'>window.close();</script>";
}
But now my issue is :
I have IDM
(Internet Download Manager) installed on my computer, and when i want to download the file... IDM
shows the download box to download the file, revealing the PHP
file path, and also it will not download the file when i hit start download, it losses the connection.
Now i don't have a problem revealing the PHP
file path since it will not download anything unless the user accepted the license and came from the correct web page, but i want at least the user to be able to download the file even if he had IDM
installed, because at this setup if the user had IDM
installed, he must turn of the integration functionality in IDM
in order to download the file through the browser correctly.
Hope someone can help me with this.