/ Published in: PHP
Simply pass the file name with path as an argument to this function and it will force that file downloading.
Expand |
Embed | Plain Text
function download_file($file){ $file = $file; //Set File Location // The following files will set the headers to the file download return "Downloading $file"; // Return Downloading FILE_NAME exit; // Stop Processing }else{ // If file is a directory return "You have selected to download a directory. Download Cancelled"; // Show error } }else{ // If file doesnt exist return "File doesnt exist"; } }
You need to login to post a comment.
