Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. <?php
  2. $file = $_GET["filename"];
  3. $file_name = basename($file);
  4. header("Content-Type: application/zip");
  5. header("Content-Disposition: attachment; filename=$file_name");
  6. header("Content-Length: " . filesize($file)); //added this line
  7. readfile($file);
  8. ?>
  9.  
  10. <a href="<?php echo $_GET["filename"]; ?>" target="_blank">click here</a>
  11.  
  12. Download.php is getting the parameter filename value correctly but says
  13.  
  14. Warning: Cannot modify header information - headers already sent by (output started at /home/content/72/11973872/html/filerepairtool/down/download.php:9) in /home/content/72/11973872/html/filerepairtool/down/download.php on line 20
  15.  
  16. Warning: Cannot modify header information - headers already sent by (output started at /home/content/72/11973872/html/filerepairtool/down/download.php:9) in /home/content/72/11973872/html/filerepairtool/down/download.php on line 21
  17.  
  18. <?php
  19. include 'file.php';
  20. ?>
  21.  
  22. <?php
  23. $file = $_GET["filename"];
  24. $file_name = basename($file);
  25. header("Content-Type: application/zip");
  26. header("Content-Disposition: attachment; filename=$file_name");
  27. header("Content-Length: " . filesize($file)); //added this line
  28. readfile($file);
  29. ?>
  30.  
  31. <!DOCTYPE html>
  32. <head>
  33. <title>Page title</title>
  34. <body>
  35. Hello world
  36.  
  37. <?php
  38. $file = $_GET["filename"];
  39. $file_name = basename($file);
  40. header("Content-Type: application/zip");
  41. header("Content-Disposition: attachment; filename=$file_name");
  42. header("Content-Length: " . filesize($file)); //added this line
  43. readfile($file);
  44. ?>
  45. </body>
  46. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement