file streaming

5 views
Skip to first unread message

Massimo Di Pierro

unread,
Mar 6, 2008, 2:27:00 AM3/6/08
to web...@googlegroups.com
Somebody asked how to stream an mp3 file:

def get_my_file():
     filename=request.args[0]
     path=os.path.join(request.folder,'uploads',filename)
     response.headers['ContentType'] ="application/octet-stream";
     response.headers['Content-Disposition']="attachment; filename=" +filename
     return response.stream(open(filename),chunk_size=4096)

limodou

unread,
Mar 6, 2008, 3:44:32 AM3/6/08
to web...@googlegroups.com

Great! I like web2py more and more.

--
I like python!
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
meide <<wxPython UI module>>: http://code.google.com/p/meide/
My Blog: http://www.donews.net/limodou

Reply all
Reply to author
Forward
0 new messages