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
 
 

Reply via email to