KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
984B

  1. <?php
  2. die('Not allowed');
  3. function downloadFile($dlFile, $dlSize) {
  4. // Must be fresh start
  5. if (headers_sent())
  6. die('Headers Sent');
  7. // Required for some browsers
  8. if (ini_get('zlib.output_compression'))
  9. ini_set('zlib.output_compression', 'Off');
  10. header("Pragma: public"); // required
  11. header("Expires: 0");
  12. header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  13. header("Cache-Control: private", false); // required for certain browsers
  14. header("Content-Type: application/force-download");
  15. header("Content-Disposition: attachment; filename=\"" . basename($dlFile) . "\";" );
  16. header("Content-Transfer-Encoding: binary");
  17. header("Content-Length: " . $dlSize);
  18. ob_clean();
  19. flush();
  20. readfile($dlFile);
  21. }
  22. if (! (empty($_GET["file"]) || empty($_GET["size"]))) {
  23. $dlFile = htmlspecialchars($_GET["file"]);
  24. $dlSize = htmlspecialchars($_GET["size"]);
  25. downloadFile($dlFile, $dlSize);
  26. }
  27. ?>