Mar
29
2017
Force Download Files in PHP
One of the most common problems that we find is to force the download of a certain file from the client’s browser, thus preventing it from opening.
For this we can use the following function in PHP.
function force_download($file) { if ((isset($file))&&(file_exists($file))) { header("Content-length: ".filesize($file)); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $file . '"'); readfile("$file"); } else { echo "No selected file"; } }
Pingback: acheter générique kamagra toronto
Pingback: ordering enclomiphene australia pharmacy
Pingback: buy cheap androxal purchase usa
Pingback: discount dutasteride generic cheapest
Pingback: discount flexeril cyclobenzaprine cheap canada
Pingback: buy cheap fildena canada discount
Pingback: how to order gabapentin generic is it safe
Pingback: online order itraconazole generic pharmacy usa
Pingback: buy staxyn overnight delivery
Pingback: how to buy avodart buy in london
Pingback: buying rifaximin online no rx
Pingback: ordering xifaxan generic buy online
Pingback: koupit kamagra ve velké británii