Looking for Idea

[All I want is the Controller to have the download action, that takes the param as the zipfile name.

On each request, I would like to increment the download counter in a table.]

This is OK

But what is the Method for the download (i mean like Render or Output). I looked in the Class reference and could not find one.

bump

bump

Did you search at php classes?

found the simplest solution to what I wanted to do -




<?php

$file = 'monkey.gif';


if (file_exists($file)) {

    header('Content-Description: File Transfer');

    header('Content-Type: application/octet-stream');

    header('Content-Disposition: attachment; filename='.basename($file));

    header('Content-Transfer-Encoding: binary');

    header('Expires: 0');

    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

    header('Pragma: public');

    header('Content-Length: ' . filesize($file));

    ob_clean();

    flush();

    readfile($file);

    exit;

}

?>



Oh man no, readfile is SO memory intensive. Redirect to the file itself after you send the headers.

You rock! why did I not think of that. Thanks man.