file-upload.php 417 B

123456789101112131415161718
  1. <?php
  2. require_once __DIR__.'/_executor.php';
  3. return function()
  4. {
  5. $uploaded = ($_FILES['file']['tmp_name'] ?? null) ? file_get_contents($_FILES['file']['tmp_name']) : null;
  6. if ($uploaded) {
  7. echo 'Upload OK';
  8. return;
  9. }
  10. echo <<<'HTML'
  11. <form method="POST" enctype="multipart/form-data">
  12. <input type="file" name="file">
  13. <input type="submit">
  14. </form>
  15. HTML;
  16. };