<?php
$filepath = __DIR__ . '/filename.txt';
$contents = @file_get_contents( $filepath );
if ( ! empty ( $contents ) ) {
header( "Cache-control: private" );
header( "Content-type: application/force-download" );
header( "Content-transfer-encoding: binary\n" );
header( "Content-disposition: attachment; filename=\"filename.txt\"" );
header( "Content-Length: " . filesize( $filepath ) );
readfile( $filepath );
exit;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.