Got the answer and the answer is:
<?
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$FileName");
header("Content-transfer-encoding: binary");
readfile($FULLPATH);
?>
But I am again facing another problem.When user click on any file name i am openning a new window with the following url :-
download.php?url=/k_map.pdf&FileName=k_map.pdf
With the help of previous post i can download any file without any problem but window will not be closed automaticaly . i tried javascript window close but not working since previously i change the header.
How window will automaticaly closed with save dialog box?????
and another problem is when i use attachement in the following line:
header("Content-Disposition: attachment; filename=$FileName" . "%20");
Then then the IE hangs up sometimes and when i am not using this then download will be limited to some files only i cann't download all files.
At present i am using the following code to in download.php
include ("../../main.php");
if(checkses() == false){
header("Location: ../login.php");
exit();
}
list($u_name,$id) = split("+",$ses_var);
$path="/home/www/htdocs/userfile/".$u_name;
$fullpath=stripslashes($path.$url);
header("Cache-control: private");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$FileName" . "%20");
header("Content-transfer-encoding: binary");
readfile($fullpath);