php




Create PHP function file function.php <?php function output_file($Source_File, $Download_Name, $mime_type='') {  /* $Source_File = path to a file to output $Download_Name = filename that the browser will see $mime_type = MIME type of the file (Optional) */  if(!is_readable($Source_File)) die('File not found or inaccessible!');  $size = filesize($Source_File);  $Download_Name = rawurldecode($Download_Name);  /* Figure […]

Force to download a file in PHP




As every web developer knows, the server default for a directory’s default file is index.{extension}. Apache is usually set to index.php or index.html. It’s a good practice to set your DirectoryIndex setting in your .htaccess file, especially if you’re hosting your website on shared hosting. A hosting provider’s guidelines could […]

Set Your Directory Index/Homepage Using .htaccess