as I said, reading the download method code I realized what you are
meaning.
Never heard of the retrieve method before and you said it is a FAQ:
shame on me!

As you stated, if not in the FAQ this should definitely go in the
Book!

Thank you again!
carlo

On 7 Apr, 14:48, selecta <gr...@delarue-berlin.de> wrote:
> i am also not sure what you exactly mean, but guessing from the fact
> that you have a table with an upload field the code above would work
> for that
> here is a more complete example
>
> db.define_table('mytable', Field('myfield','upload'))
> db.mytable.insert(myfield = db.mytable.myfield.store(open('/etc/
> issue'), 'issue file'))
> #this is done somewhere in the background when a form is processed so
> 'issue file' would be the original file name in that case
>
> record = db.mytable[1]
> filename, file = db.mytable.myfile.retrieve(record.myfile)
> print A(filename, _href = URL(request.application, 'default',
> 'download', args = record.myfile))
>
> it returns
> <a href="/myapplication/default/download/
> XXXXSOMESTRANGECODEHERE">issue file</a>
>
> so you have the original file name and the name under which it is
> stored? what other original file name would you need?
>
> On Apr 7, 1:53 pm, carlo <syseng...@gmail.com> wrote:
>
> > mmh, thank you Selecta but I think I did not understand that.
> > Could you point me to one of the past posts?
> > I do not want to store the original filename in my table, just to get
> > the decoded original filename (the one used by the download function
> > to set the disposition header).
> > I do not think your solution addresses that but maybe I am wrong
> > sorry.
>
> > On 7 Apr, 13:24, selecta <gr...@delarue-berlin.de> wrote:
>
> > > record = db.mytable[1]
> > > filename, file = db.mytable.myfile.retrieve(record.myfile)
> > > A('%s'%filename, _href = URL(request.application, 'default',
> > > 'download', args = record.myfile))
>
> > > i read the answer on this mailing list and i provided it to others
> > > like 50 times, this should go into the FAQ of web2py
>
>

Reply via email to