This is my other account. I found the problem, the url structure was bad
cos i checked with the google docs viewer syntax and it needed the url to
be url encoded, http://blablabla, but the url that gets submitted when i do
URL('download', args=update.file) is sent in the form
/[app]/default/download/file without the http://domain.com, i changed that
to the absolute path and it worked. what i have a problem with now is being
able to resize the embedded document... it appears in a small box and i
don't know how to resize it.... help please?
On Wednesday, February 19, 2014 2:36:10 PM UTC, Anthony wrote:
>
> What is the HTML code generated in this case? Have you verified that you
> can successfully download the file in question at your URL?
>
> Anthony
>
> On Tuesday, February 18, 2014 11:08:57 AM UTC-5, sasogeek wrote:
>>
>> in db.py, the table status is defined as follows
>> db.define_table(
>> 'status',
>> Field('status', 'text'),
>> Field('file', 'upload'),
>> Field('userid'),
>> )
>>
>> and in default.py, the download function is defined as
>> def download():
>> """
>> allows downloading of uploaded files
>> http://..../[app]/default/download/[filename]
>> """
>> return response.download(request, db)
>>
>> just like in the tutorial book.
>> and in the views, i have this code
>>
>> {{from gluon.contrib.autolinks import expand_one}}
>> ...
>> {{updates=db().select(db.status.ALL, orderby=~db.status.id)}}
>> {{if updates:}}
>> {{for update in updates:}}
>> {{=XML(expand_one(URL('download',
>> args=update.file,),cache.ram('mycache',lambda:dict(),3600)))}}
>> {{pass}}
>> {{pass}}
>>
>>
>> if update.file is an image, it works fine and the image is rendered just
>> fine, but when it's a pdf, it doesn't work, I get this error
>> Sorry, we were unable to find the document at the original source. Verify
>> that the document still exists. You can also try to download the
>> original document by clicking here
>>
>> When I click on the link that says "here", it opens a google docs page in
>> a new window with the same error statement in it.... how do i fix this?
>>
>>
--
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/groups/opt_out.