Two issues:

- you are donwloading from private not uploads folder. Thenically this
is ok but not a web2py convention. You should not expose the content
for the private folder. That is why it is called private. ;-)

- you used embed to embed a file, but it should be used to embed a
plugin. I have used a flash plugin for this purpose.

Here is an app to manage music files that you can use as example:

http://web2py.com/examples/static/web2py.app.music.w2p

Massimo

On Jun 22, 10:50 pm, weheh <[email protected]> wrote:
> Continuing this old 
> thread:http://groups.google.com/group/web2py/browse_thread/thread/59b66b3a24...
>
> I'm having trouble getting an embedded mp3 from showing up in my web
> page. I'm trying to implement this almost exactly as Massimo suggested
> in the above thread. Anybody know why my code below isn't functioning?
>
> #controller "audio.py"
> def download_audio():
>   f=os.path.join(request.folder,'private',request.args(0))
>   return response.stream(open(f,'rb'))
>
> #model "show_audio.py"
> def show_audio():
>   filename='audio/aab/hello_world.mp3'  # this is a hardcoded value
> for this test case
>   url=URL(r=request,c='audio',f='download_audio',args=filename)
>   return EMBED(_src=url,_autoplay='true')
>
> #view "index.html"
> {{=show_audio()}}

Reply via email to