Hi Johann,
Make sure to set the content-disposition header if you would like to set
the filename.
Also, the filename extension has to match your content-type or the
browser might reject it, however that depends on the browser.
--
Thadeus
On Sat, 2010-04-10 at 23:56 +0200, Johann Spies wrote:
> I have this in my view:
>
> <a href={{URL(r=request,f='csv',vars=dict(query=query))}}>
> Download as csv-file </a>
>
> And this controller:
>
>
> def csv():
> import cStringIO
> s=cStringIO.StringIO()
> response.headers['Content-Type']='application/vnd.ms-excel'
>
> db(request.vars.query).select(db.sarua.All,limitby(1,250)).export_to_csv_file(s)
> return s.getvalue()
>
>
> When I click on the link, it seems the browser shows some sort
> activity but there is no download taking place. What am I doing wrong?
>
> I will be so glad if I can get this working. I have spent many hours
> in trying to get it to work.
>
> Regards
> Johann
> --
> "Finally, brethren, whatsoever things are true, whatsoever things are
> honest, whatsoever things are just, whatsoever things are pure,
> whatsoever things are lovely, whatsoever things are of good report; if
> there be any virtue, and if there be any praise, think on these
> things." Philippians 4:8
>
>
--
To unsubscribe, reply using "remove me" as the subject.