Craft\Formerly_SubmissionsController::actionViewUpload PHP Method

actionViewUpload() public method

public actionViewUpload ( array $variables = [] )
$variables array
    public function actionViewUpload(array $variables = array())
    {
        if (!empty($variables['fileId'])) {
            $fileId = $variables['fileId'];
            $asset = craft()->assets->getFileById($fileId);
            $serverPath = $asset->source->attributes['settings']['path'];
            $data = file_get_contents($serverPath . $asset->filename);
            header("Content-type: " . $asset->mimeType);
            header("Content-disposition: attachment;filename=" . $asset->filename);
            echo $data;
        }
        return;
    }