Download an uploaded file

@return Void
323626
public function downloadAction() {
        $ini = Zend_Registry::get('config');
        $downloadType = $this->getRequest()->getParam('downloadType') ?: Garp_File::TYPE_DOCUMENTS;
        $uploadOrStatic = $this->getRequest()->getParam('uploadOrStatic') ?: 'upload';
        $file = $this->getRequest()->getParam('file');

        if (!$file) {
            throw new Zend_Controller_Action_Exception('Geen bestandsnaam opgegeven.', 404);
        }

        try {
            $fileHandler = new Garp_File($downloadType, $uploadOrStatic);
            $url = $fileHandler->getUrl($file);
            $this->_downloadFile($url);
        } catch (Garp_File_Exception_InvalidType $e) {
            // Just throw a 404, since the error is basically just a wrong URL.
            throw new Zend_Controller_Action_Exception($e->getMessage(), 404);
        }
    }
190681
public function upload()
    {
        if ($newFile = $this->getNewFileName()){
            $origin = $destination = \Devil::getPathOf($this->config['dest']);
            $this->remove();
            if (isset($this->config['onload'])) {
                $destination .= '/origin';
            }
            if (!is_dir($destination)) mkdir ($destination, 0777, true);
            $realFileName = $destination . '/' . $this->_primaryKey . '_' . $this->getNewFileName();
            if (move_uploaded_file($this->uploaded['tmp_name'], $realFileName)) {
                if (isset($this->config['onload'])) foreach ($this->config['onload'] as $method=>$config) {
                    $this->$method($realFileName, $origin, $config, $this->_primaryKey . '_' . $this->getNewFileName());
                }
            }
        }
    }
108848
public function downloadAction()
	{
		$paths = Base::getAimeos()->getCustomPaths( 'client/html' );
		$context = $this->getContext();
		$view = $context->getView();

		$client = \Aimeos\Client\Html::create( $context, 'account/download' );
		$client->setView( $view );
		$client->process();

		$response = $view->response();
		$this->response->setStatus( $response->getStatusCode() );

		foreach( $response->getHeaders() as $key => $value ) {
			$this->response->setHeader( $key, implode( ', ', $value ) );
		}

		return (string) $response->getBody();
	}
1163237
function download($file_pointer) {
    if (empty($this->download_url)) {
      $this->_save(Recurly_Client::GET, $this->getHref());
    }
    $this->_client->getFile($this->download_url, $file_pointer);
  }
502769
public function downloadFromCloud()
    {
        if ($this->owner->CloudStatus === 'Live') {
            $bucket   = $this->owner->getCloudBucket();
            if ($bucket) {
                $contents = $bucket->getContents($this->owner);
                $path     = $this->owner->getFullPath();
                Filesystem::makeFolder(dirname($path));
                CloudAssets::inst()->getLogger()->debug("CloudAssets: downloading $path from cloud (size=".strlen($contents).")");
                // if there was an error and we overwrote the local file with empty or null, it could delete the remote
                // file as well. Better to err on the side of not writing locally when we should than that.
                if (!empty($contents)) {
                    file_put_contents($path, $contents);
                }
            }
        }
    }
1174244
public function download($file, $name = null, array $headers = array(), $disposition = 'attachment')
	{
		$response = new BinaryFileResponse($file, 200, $headers, true, $disposition);

		if ( ! is_null($name))
		{
			return $response->setContentDisposition($disposition, $name, str_replace('%', '', Str::ascii($name)));
		}

		return $response;
	}
438696
public function download()
    {
        $oUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
        $oUtils->setHeader("Pragma: public");
        $oUtils->setHeader("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        $oUtils->setHeader("Expires: 0");
        $oUtils->setHeader("Content-Disposition: attachment; filename=vouchers.csv");
        $oUtils->setHeader("Content-Type: application/csv");
        $sFile = $this->_getExportFilePath();
        if (file_exists($sFile) && is_readable($sFile)) {
            readfile($sFile);
        }
        $oUtils->showMessageAndExit("");
    }
371355
public function upload()
	{
		$response = array('uploaded' => false);

		foreach ((array)$_FILES as $file) {
			$targetFolder = isset($_POST['folder']) ? $_POST['folder'] : '/';
			$response = array_merge($response, $this->uploadFile($file, $targetFolder . '/'));
		}
        $this->returnJson($response);
	}
799298
public function download($file, $name = null, array $headers = [], $disposition = 'attachment')
    {
        $response = new BinaryFileResponse($file, 200, $headers, true, $disposition);

        if (! is_null($name)) {
            return $response->setContentDisposition($disposition, $name, $this->fallbackName($name));
        }

        return $response;
    }
374819
public function download(string $file, string $showName = null): void
    {
        $this->handleFile($file, $showName);
    }
446343
public function download($filename = null)
    {
        $filename = $filename ?: date('Y-m-d_His') . '.csv';
        $this->writer->output($filename);
    }
60385
public function saveUploadedFiles()
    {
        try
        {
            if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
            {
                throw new Exception($this->trans('errors.upload.plugin'));
            }
            elseif(!$xUploadPlugin->canProcessRequest())
            {
                throw new Exception($this->trans('errors.upload.request'));
            }
            // Save uploaded files
            $sKey = $xUploadPlugin->saveUploadedFiles();
            $sResponse = '{"code": "success", "upl": "' . $sKey . '"}';
            $return = true;
        }
        catch(Exception $e)
        {
            $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}';
            $return = false;
        }
        // Send the response back to the browser
        echo '<script>var res = ', $sResponse, '; </script>';
        if(($this->getOption('core.process.exit')))
        {
            exit();
        }
        return $return;
    }
1050509
public function getFile()
    {
        $variableUri = $_POST["variableUri"];

        $delivery = $this->getResource(tao_helpers_Uri::decode($this->getRequestParameter('deliveryUri')));
        try {
            $this->getResultStorage($delivery);

            $file = $this->getResultsService()->getVariableFile($variableUri);
            header(
                'Set-Cookie: fileDownload=true'
            ); //used by jquery file download to find out the download has been triggered ...
            setcookie("fileDownload", "true", 0, "/");
            header("Content-type: " . $file["mimetype"]);
            if (!isset($file["filename"]) || $file["filename"] == "") {
                header('Content-Disposition: attachment; filename=download');
            } else {
                header('Content-Disposition: attachment; filename=' . $file["filename"]);
            }

            echo $file["data"];
        } catch (\common_exception_Error $e) {
            echo $e->getMessage();
        }
    }
131096
public static function download($file, $status = 200, $headers = array())
    {
        require_once ABSPATH.'wp-admin/includes/file.php';

        WP_Filesystem();

        global $wp_filesystem;

        $fileData = $wp_filesystem->get_contents($file);

        $downloadHeader['Content-Description'] = 'File Transfer';
        $downloadHeader['Content-Type'] = 'application/octet-stream';
        $downloadHeader['Content-Disposition'] = 'attachment; filename='.basename($file);
        $downloadHeader['Content-Transfer-Encoding'] = 'binary';
        $downloadHeader['Expires'] = '0';
        $downloadHeader['Cache-Control'] = 'must-revalidate';
        $downloadHeader['Pragma'] = 'public';
        $downloadHeader['Content-Length'] = filesize($file);

        $response = new Response($fileData, 200, $downloadHeader);
        $response->send();
    }
1003563
def download
      @uploaded_file = UploadedFile.where(title: params[:title]).first
      unless @uploaded_file
        raise ActiveRecord::RecordNotFound, "Could not find file '#{params[:title]}'"
      end
      redirect_to @uploaded_file.file_url
    end
24628
protected function downloadErrorsDownload()
    {
        $file = $this->install_model->getErrorLogFile();

        if ($this->isQuery('download_errors') && is_file($file)) {
            $this->download($file);
        }
    }
1199191
public function download() {
        \core\session\manager::write_close();
        $this->out($this->get_total_responses_count(), false);
        exit;
    }