This worked perfectly, thanks!

How would I serve up the image if I was broadcasting an XML service
API?

I want my service to respond to a request with images that can be
displayed on their website.

Thanks!

On Jun 15, 1:57 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I marked with ## the lines that I added, changed. Hope it is self-
> explanatory.
> Let me know if this fixes it.
>
>     def add():
>         form = SQLFORM(db.apps)
>         if form.accepts(request.vars, session):
>                 redirect(URL(r=request, c='default', f='index'))
>         records=db(db.apps.id>0).select()   ####
>         return dict(form = form,records=records) ###
>
>     def download(): ###
>         return response.download(request,db) ###
>
> And in the view
>
>                         {{for app in records:}}
>                         <div>
>                                 <img src="{{=URL(r=request,
> f='download', args=app.screenshot)}}"> ####
>                                 {{=A(app.name, _href=URL(r=request,
> f=app.link))}}
>                                 <span>by {{=app.author}}</span>
>                                 <br/>
>                                 <span>{{=app.description}}</span>
>                         </div>
>                         {{pass}}
>
> On Jun 14, 10:28 pm, Michael <michael.no...@gmail.com> wrote:
>
>
>
> > I have a model that has:
>
> >          db.Field('screenshot', 'upload'))
>
> > In my controller i have:
>
> >        def add():
>
> >         form = SQLFORM(db.apps)
>
> >         if form.accepts(request.vars, session):
> >                 redirect(URL(r=request, c='default', f='index'))
>
> >         return dict(form = form)
>
> > and in my view I have:
>
> >                         {{for app in records:}}
> >                         <div>
> >                                 <img src="{{=URL(r=request, c='uploads', 
> > f=app.screenshot)}}">
> >                                 {{=A(app.name, _href=URL(r=request, 
> > f=app.link))}}
> >                                 <span>by {{=app.author}}</span>
> >                                 <br/>
> >                                 <span>{{=app.description}}</span>
> >                         </div>
> >                         {{pass}}
>
> > this returns a broken image. anyone know how to display an image from
> > the upload of a form?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to