Thanks for your informative responses Anthony. I will do some
exploring when I get a chance.

The URL I gave in the example happens behind the scenes, so it does
not get displayed to the user. But your comments about security are
useful.

Peter

On Aug 15, 7:08 pm, Anthony <[email protected]> wrote:
> On Monday, August 15, 2011 11:08:10 AM UTC-4, Anthony wrote:
>
> > On Monday, August 15, 2011 6:09:00 AM UTC-4, peter wrote:
>
> >> If I have a url
>
> >> .../default/my_download/abc.mp3?album=def&filename=ghi.mp3
>
> >> Then it does correctly download  web2py/albums/def/ghi.mp3
>
> >> The popup for the user say 'do you want to open or save "abc.mp3"
>
> > I'm not sure web2py is doing anything to affect that -- I think it's
> > probably the browser -- when it receives the audio stream, it assumes the
> > name is the last part of the URL before the query string. You might be able
> > to fix that by setting the Content-Dispostion header
>
> > response.headers['Content-Disposition'] = 'inline; filename=%s' %
> > request.vars.filename   # for streaming
>
> > response.headers['Content-Disposition'] = 'attachment; filename=%s' %
> > request.vars.filename   # to force download as attachment
>
> Note, I'm not sure specifying 'filename' has any effect with 'inline'. Also,
> you may need to url encode the filename before adding it to the header.
>
> Anthony- Hide quoted text -
>
> - Show quoted text -

Reply via email to