[TYPO3-mvc] link.action format="..."

Franz Koch typo3.RemoveForMessage at elements-net.de
Tue Jan 25 18:04:01 CET 2011


Hey,

> One action of my extension should return a csv file, so I set
> format=".csv" but got the error message that the view template could
> not be found. Changing the format to "csv" helped in the end, but I
> think the error message should contain the name for the searched
> template as well. (I didn't expect that the extension of the template
> file and the format have to match and the example talks about
> '.html'.)
>
> But the result of the action is just output to the browser and not a
> file. So how do I achieve this?

well, how should extbase know that it should serve the response as 
download file and under which file name? You're sending a web-request to 
it and it's responding with a web response (output in the browser). The 
format doesn't specify the type of response, only the formatting 
(template) to use.

So if you like to provide a file download, you have to take care about 
that in your controller by your own. Best might probably be to add a 
"export" or "download" action to your controller that's dealing with all 
the needed stuff, like sending the correct headers (content type, 
content length, file name, headers triggering the download dialog of the 
browser) and the file content itself.
Which headers have to be sent can be found on the net - it's the same 
for every download feature (the php.net website itself has some usefull 
user comments for download headers). Hope that helps.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list