This
('../uploads/{{=record.image}}') ;
should instead be
{{=URL(r=request,f='dowload',args=record.image)}}
and you need a controller like
def download():
import os
return response.stream(os.join
(request.folder,'uploads',request.args[0]))
web2py does not automatically serve files other those in the static
folder. Otherise it would be a big security risk.
Massimo
On Jan 18, 11:00 am, annet <[email protected]> wrote:
> Massimo,
>
> I don't have an upload or download function. In the controller I have
> a function compage which contains the following lines of code:
>
> def compage():
> records=db(db.images.organisation==id).select(db.images.ALL)
> ....
> return dict(records=records)
>
> As I explained in my previous post, I then have the following code in
> the view:
>
> {{for record in records: }} #{{=record.tag}} { background-image: url
> ('../uploads/{{=record.image}}') ;
> {{pass}}
>
> which is part of the following <style></style> element:
>
> <style type="text/css">
> {{for record in records: }}
> #{{=record.tag}} {
> background-image: url('../uploads/{{=record.image}}') ;
> background-repeat: repeat-x ;}{{pass}}
>
> </style>
>
> The problem results from the fact that the uploads folder isn't
> accessible from the browser. When I put the images in anither folder
> the problem is solved, but I want the user to be able to upload and
> delete an image using the upload facilities in web2py. Voltron solved
> this problem in the thread mentioned above, however, I haven't got a
> clue how he did that. Maybe using the download action would solve the
> problem but I don't know how to implement that.
>
> Best regards,
>
> Annet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---