Source Code for Me (s-c.me)

Allows you to paste souce code to blogs! Adapted for Twitter! Here is Search Form in case you missed your code.
Code:
Selected Language:
Show Linenumbers:
Short link for Twitter:
HTML:

HTML view:

Copy Source | Copy HTML
  1. // simple http download by Sergey Shuchkin
  2. function download( $filename, $as = false, $exit = false ) {
  3.     header('Content-type: application/octet-stream');
  4.     header('Content-Disposition: attachment; filename="'.($as ? $as : basename($filename)).'"');
  5.     header('Last-Modified: ' . date('D, d M Y H:i:s \G\M\T' , filemtime( $filename ) ));
  6.     header('Content-Length: '.filesize($filename));
  7.     $fp = fopen( $filename, 'rb');
  8.     if ($fp) {
  9.         fpassthru( $fp );
  10.         fclose( $fp );
  11.     }
  12.     if ($exit) exit();
  13. }




Based on Manoli.Net's CodeFormatter. Made by Topbot (c) 2008-2012