Skip to content

Instantly share code, notes, and snippets.

@staylor
Created November 25, 2014 22:05
Show Gist options
  • Save staylor/02fb932d12fe5786b8eb to your computer and use it in GitHub Desktop.
Save staylor/02fb932d12fe5786b8eb to your computer and use it in GitHub Desktop.
File download thing
<?php
header( 'Cache-Control: no-cache, no-store' );
header( 'User-Agent: My Cool Download Script' );
header( 'Content-Disposition: inline; filename=TARGET_FILENAME_WITH_NO_PATH' );
header( 'Content-type: MIME_TYPE_OF_FILE;charset=CHARSET_OF_FILE' );
header( 'Vary: Accept-Encoding' );
header( 'Keep-Alive: timeout=15, max=1024' );
header( 'Connection: Keep-Alive' );
// readfile() or echo contents of file, whatever
echo 'HELLO FILE CONTENTS';
exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment