sendfile - Sends a file.
sendfile([finish:true|false, ct:""], files ….);
This function is used to send files immediately to the output.
If "finish" is not defined or it is true, the program stops and the output that was already in the buffer is cleared.
ct is used to specify content type of the file. If it is not specified, mime types of Apache are used.
Note: In the followings examples, the _ between the { should be removed to make it work.
res={_{ a=xls_new(); xls_set(xls:a,x:1,y:1,str:"test"); xls_set(xls:a,x:1,y:2,str:"1234"); xls_write(xls:a,file:"/tmp/test.xls"); xls_free(a); headers_out("Content-Disposition",'attachment; filename="test.xls"'); sendfile("/tmp/test.xls", finish:false); remove("/tmp/test.xls"); clear_output(); stop(); }}. will send the xls file to the output
Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
1.0 2014-09-09 21:24:14 laplante@sednove.com