Not sure I understand. The uploaded images have URL equal to URL(r=request,f='download', args=app.screenshot)
you can use this to build the XML tags. Alternative you can do db.apps.screenshot.represent=lambda value: URL(r=request,f='download', args=value) Massimo On Jun 16, 5:47 pm, Michael <[email protected]> wrote: > 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 <[email protected]> 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 <[email protected]> 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 [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 -~----------~----~----~----~------~----~------~--~---

