sorry I forgot.

Imagine you have:

db.define_table('mytable',Field('somedata','text'))

you can define an action:

def gimmefile():
    # http://..../gimmefile/<id>
    myrecord=db.mytable(request.args(0))
    filename = "%s.txt" % myrecord.id
    response.headers['Content-Dispotion']="attachment;filename=%s" %
filename
    return myrecord.text




On Sep 17, 3:18 am, till <[email protected]> wrote:
> cheers!
>
> do you have yet another solution for the string to file dl idea?
>
> thanks :-)
>
> On Sep 16, 5:51 pm, mdipierro <[email protected]> wrote:
>
> > filename,stream=db.dogs.image.retrieve(doggies[0].image)
> > data=stream.read()
>
> > On Sep 16, 10:11 am, till <[email protected]> wrote:
>
> > > hi all,
>
> > > wondering how I can get the raw data of files uploaded into a db field
> > > to work with it.
> > > such as:
> > > doggies = db().select(db.dogs.ALL)
> > > doggies[0].image <- how can I access the raw data of the img?
>
> > > also, if I have a text in the db, how can I allow the user to download
> > > a file with just the content of this one field, with a given filename
> > > it will use in the "save as"?
>
> > > thanks in advance
>
>

Reply via email to