I am following @rochacbruno's pdf view example here
https://groups.google.com/forum/#!msg/web2py/tWG-GBN-Re0/vbrZOknlBgAJ . The
code is as follows below, it works brilliantly but I wanna know how I can
have the pdf displayed or downloaded with a proper name which i select as
opposed to this *( aaf5d3f7779841d0.**6e65775f64616c5f68656c702e7064*
*66.pdf ) *
<http://127.0.0.1:8000/pdfs/static/pdfs/pdfs.file.aaf5d3f7779841d0.6e65775f64616c5f68656c702e706466.pdf>
*CODE*
*<model>*
*db.define_table('pdfs',*
* Field('file','upload',*
*uploadfolder=request.folder+'**static/pdfs')*
* )*
*</model>*
*Create a viewer function wich redirects the user direct to the file, then,
if the user has adobe acrobat plugin to view the file in browser, this file
will be shown in the browser, else, will be downloaded.*
*<controller>*
*def viewer():*
* row = db(db.pdfs.id <http://db.pdfs.id>==request.args(0)*
*).select(db.pdfs.file).first()*
* redirect(URL('static','pdfs',**args=row.file))*
*</controller>*
*Now you can call this as:*
*http://127.0.0.1:8000/pdfs/default/viewer/3
<http://127.0.0.1:8000/pdfs/default/viewer/3> #record id*
*which redirects the user to:*
*http://127.0.0.1:8000/pdfs/static/pdfs/pdfs.file.aaf5d3f7779841d0.6e65775f64616c5f68656c702e706466.pdf
<http://127.0.0.1:8000/pdfs/static/pdfs/pdfs.file.aaf5d3f7779841d0.6e65775f64616c5f68656c702e706466.pdf>*
Regards
Mostwanted
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.