Massimo, thanks for the app. I'm studying it.

>From the doc, I'm not sure I get a crystal clear understanding of what
the web2py convention is.

Let's say my app lets you upload a music mp3 file, a file with a
description (liner notes), and a jpeg (album cover). These get
uploaded to "uploads". Should I allow them to be downloaded from
uploads or do I need to move them both to "static" first?

What if I mix the uploaded mp3 with some more music to make another
mp3 file, which isn't uploaded. Should it be moved to the static
folder?

Finally, the doc says, "private files are accessed by the controllers
but not directly by the
developer." I've been trying to parse that statement but it makes no
sense to me. I'm the developer. I write the controller. My controller
tries to access private directly. Does that make me not the developer?
So what exactly is the purpose of the private folder?

On Jun 23, 3:15 am, mdipierro <[email protected]> wrote:
> 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