function

sendfile . files . sncode

VERSIONlatest Send a file.

SENDFILE

NAME

sendfile - Sends a file.

SYNOPSIS

sendfile([finish:true|false, ct:""], files ….);

DESCRIPTION

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.

EXAMPLES

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

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>