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.

DownloadForced.php 963B

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