If you apply access control to your files, than they are referenced by
the database. In this case you should use the
db.table.field.store(stream,filename) method to store the stream into
uploads. If there is no access control put it in static.

On Jun 24, 10:14 am, weheh <richard_gor...@verizon.net> wrote:
> So where would I put text and mp3 files that are created by my system
> (not uploaded) and available to end users subject to access control:
> static or uploads? That doesn't seem to fall into any of your
> conventional categories.
>
> On Jun 24, 8:30 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > My convention is:
>
> > static: files that are public
> > uploads: files that are uploaded into the system and may be subject to
> > access control
> > private: files that the app needs but are not sent over the network
>
> > If you use the built-in upload mechanism it is not a good idea to move
> > the file.
>
> > On Jun 23, 12:13 pm, weheh <richard_gor...@verizon.net> wrote:
>
> > > 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 <mdipie...@cs.depaul.edu> 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 <richard_gor...@verizon.net> 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()}}- Hide quoted text -
>
> > - Show quoted text -

Reply via email to