response.headers['Content-Disposition'] = 'attachment' !!
2014-11-14 13:50 GMT+00:00 António Ramos <ramstei...@gmail.com>: > like i did the mp3 is played in the webpage. > > I want the browser to "download" it > > Is there a trick in the code ? > > Thank you > > 2014-11-14 12:56 GMT+00:00 António Ramos <ramstei...@gmail.com>: > >> row=db(db.mp3s.keyflag==request.args[0]).select().first() >> >> filename=os.path.join(request.env.web2py_path,"applications",request.application,"uploads",row['mp3']) >> response.headers['Content-Type']='audio/mpeg' >> return open(filename,'rb') >> >> It works >> :) thank you >> >> 2014-11-14 12:38 GMT+00:00 António Ramos <ramstei...@gmail.com>: >> >>> but how do i code a controller that accepts the name or other field and >>> returns the mp3 saved ? >>> >>> >>> 2014-11-14 12:31 GMT+00:00 Leonel Câmara <leonelcam...@gmail.com>: >>> >>>> Well if you coded it like that you saved the original filename in the >>>> name field, the cloudservice can just use that. >>>> >>>> -- >>>> 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. >>>> >>> >>> >> > -- 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.