download_file.php 331 B

1234567891011121314151617
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. namespace App;
  3. /**
  4. * @var string $type
  5. * @var string $id
  6. */
  7. switch($type) {
  8. case "ticket-comment-attachment":
  9. $attachment = TicketCommentAttachment::require($id);
  10. header("Content-Type: $attachment->mime_type");
  11. readfile($attachment->getPath());
  12. exit(0);
  13. }