Thank you Jim, I'll try it out but i think JavaScript may just be my way out like you said but I'll give your solution a try, thanks.
On Wednesday, February 7, 2018 at 12:53:12 AM UTC+2, Jim S wrote: > > Based on my experience and simple web protocols, you can't do what you > want. You could however combine all the images into one file (a zip file) > and download that zip file. In your controller you could do something like > this: > > import os > import StringIO > import zipfile > > tempfile = StringIO.StringIO() > ziph = zipfile.ZipFile(tempfile, 'w', zipfile.ZIP_DEFLATED) > > # psuedo code here > loop through all the picture files you want to download: > ziph.write(file) # add the file to the zip file - 'file' needs to be > full path of the file > > ziph.close() > response.headers['Content-Disposition'] = 'attachment;filename=images.zip' > response.headers['Content-Type'] = 'application/zip' > rtn = tempfile.getvalue() > tempfile.close() > > return rtn > > Hope this helps. > > If you truly want to download multiple files at once I think you're going > to have to go with some javascript magic. Since it is a bit of > non-standard way of doing things I've never attempted... > > -Jim > > > On Sunday, February 4, 2018 at 4:00:13 PM UTC-6, mostwanted wrote: >> >> I have a table which stores different images of different places, what i >> want is for the site users to be able to download all the images of a >> selected place >> by clicking the download button without having to download the images one >> at a time. How can i achieve this?? >> >> I tried this below: >> >> *MODEL:*db.define_table('location', >> Field('Image', 'upload'), >> Field('formTitle', requires=IS_NOT_EMPTY()), >> Field('place', 'reference >> area'),migrate=False,fake_migrate=True) >> >> >> *CONTROLLER*def areas(): >> form=db.place(request.args(0)) >> images=db(db.location.place==form.id).select(db.location.ALL) >> return dict(images=images, form=form) >> >> >> *VIEW*{{extend 'layout.html'}} >> <div> >> {{for pics in images:}} >> <a style="margin-left: 60px;" >> href="{{=URL('download',args=pics.Image)}}">Download</a> >> {{pass}} >> </div> >> >> Unfortunately the above attempts do not give me what i want, please >> assist. >> Thank you. >> > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.