fork(2) download
  1. <?php
  2.  
  3. require_once "/lib/pdo.php";
  4.  
  5. require 'Slim/Slim.php';
  6.  
  7. // $mapper=new DataMapper($DBH);
  8.  
  9. \Slim\Slim::registerAutoloader();
  10. $app = new \Slim\Slim();
  11.  
  12.  
  13.  
  14. $mapper=new DataMapper($DBH);
  15.  
  16. $app->get('/:id', $file=function ($id) use ($mapper){
  17.  
  18. return $mapper->showFilebyID($id);
  19. });
  20. $app->run();
  21.  
  22. if (isset($_POST['submit']))
  23. {
  24. echo "ddd";
  25. }
  26.  
  27. if (isset($_POST['submit']))
  28. {
  29. $filename=$file->showName();
  30. $filesize=$file->showSize();
  31. header("Pragma: public");
  32. header("Expires: 0");
  33. header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  34. header("Cache-Control: private",false); // нужен для некоторых браузеров
  35. header("Content-Type: jpg");
  36. header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
  37. header("Content-Transfer-Encoding: binary");
  38. header("Content-Length: ".$filesize);
  39. readfile("$filename");
  40. }
  41.  
  42.  
  43. include "templates/file.html";
  44.  
  45. ?>
  46.  
  47. <!DOCTYPE html>
  48. <html lang="en">
  49. <head>
  50. <meta charset="UTF-8">
  51. <title>Profile</title>
  52. </head>
  53. <body>
  54.  
  55. <form method='post' action=''>
  56. <input type='submit' value='скачать' />
  57. </form>
  58.  
  59.  
  60. </body>
  61. </html>
Runtime error #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  require_once(/lib/pdo.php): failed to open stream: No such file or directory in /home/nHlMPA/prog.php on line 3
PHP Fatal error:  require_once(): Failed opening required '/lib/pdo.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/nHlMPA/prog.php on line 3