ERRATA. This will not work. I overlooked the fact you put something
under uploads that is not actually uploaded and does not follow
appropriate naming convention.

You need:

1) your own action in controllers/audio.py

def download_audio():
   f=os.path.join(request.folder,'uploads',request.args(0))
   return response.stream(open(f,'rb'))

2) in view

{{audio_filename='folder1/folder2/audio_filename.mp3'}}
{{url=URL
(r=request,c='audio',f='download_audio',args=audio_filename)}}
<embed src="{{=url}} />

Anyway. This kind of stuff should go under 'private' not 'uploads'.
That is what private is for.


On Jan 7, 4:37 pm, mdipierro <[email protected]> wrote:
> Summing you have a download in controller default.py
>
> {{audio_filename='folder1/folder2/audio_filename.mp3'}}
> {{url=URL(r=request,c='default',f='download',args=audio_filename)}}
> <embed src="{{=url}} />
>
> On Jan 7, 4:22 pm, weheh <[email protected]> wrote:
>
> > Sorry, Massimo, no joy.
>
> > What is my download controller supposed to look like and what folder
> > and file is it supposed to be in?
>
> > Currently, the view is called from controller "audio" and action
> > "index". audio.py has
>
> > def download():
> >   return response.download(request,db)
>
> > I also tried making a controllers/download.py with a def index():
> > return response.download(request,db), but of course, that didn't work
> > either. Don't ask me why x|
>
> > Sorry, now I'm groping.
>
> > The audio is under
> >   /app/uploads/folder1/folder2/audio_filename.mp3
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to