You are here

Download.php in DRD Agent 4.0.x

Same filename and directory in other branches
  1. 8.3 src/Agent/Action/Download.php

File

src/Agent/Action/Download.php
View source
<?php

namespace Drupal\drd_agent\Agent\Action;

use Drupal\drd_agent\Controller\Agent;
use Symfony\Component\HttpFoundation\BinaryFileResponse;

/**
 * Offers a download file.
 */
class Download extends Base {

  /**
   * {@inheritdoc}
   */
  public function execute() {
    $args = $this
      ->getArguments();
    $filename = $this->crypt
      ->encryptFile($args['source']);
    $header = Agent::responseHeader();
    $header['X-DRD-Encrypted'] = $filename !== $args['source'];
    return new BinaryFileResponse($filename, 200, $header, FALSE);
  }

}

Classes

Namesort descending Description
Download Offers a download file.