Để ẩn link download file đc attach trên host em viết hàm dlfile trong download.php như vầy:
Code:
function dlfile($file)
{
header("Content-Disposition: attachment; filename=filename.zip");
exit();
}Em có 2 thắc mắc:
1.Hàm trên chỉ có thể download đc các file nằm trong các sub folder của folder chứa file php download.php, em có một file bất kì nằm trên host thì phải cho cái filename= gì?
2.Nếu muốn ẩn link download từ trang khác thì sao ví dụ chỉ cần đưa url của file thì nó sẽ download, em có thử như vầy như ko xi nhê
Code:
function dlfile($url)
{
header("Content-Disposition: attachment; filename=$url");
exit();
}