In pylons how do I force user to download a file?

31 Views Asked by At

From a pylon controller action, instead of rendering a template, I want to send a file to the user to download. In languages like PHP, I can do the this thing like following. How can I do this in pylons?

header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"file.exe\""); 
echo readfile($url);
0

There are 0 best solutions below