Download a .php file?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Download a .php file?

    is it possible to download a .php file directly?

    #2
    Yes 4m ur hosting file manager or ftp :p bt n0t 4m externel site.

    Comment


      #3
      PHP Code:
      <?php
      $file = 'file.php'; // name of the file you want to download
      
      if (file_exists($file)) {
          header('Content-Description: File Transfer');
          header('Content-Type: application/octet-stream');
          header('Content-Disposition: attachment; filename='.basename($file));
          header('Content-Transfer-Encoding: binary');
          header('Expires: 0');
          header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
          header('Pragma: public');
          header('Content-Length: ' . filesize($file));
          ob_clean();
          flush();
          readfile($file);
          exit;
      }
      ?>

      Comment


        #4
        Yes, by using force download. But of course you need to set it up first.
        Did I help you?
        You can help me too
        Your donations will help me finance my studies.

        Comment

        Working...
        X