TCPIP_HTTP_FileInclude Function

C

void TCPIP_HTTP_FileInclude(
    HTTP_CONN_HANDLE connHandle, 
    const uint8_t* cFile
);

Description

This function allows an entire file to be included as a dynamic variable, providing a basic templating system for HTML web pages. This reduces unneeded duplication of visual elements such as headers, menus, etc.

When pHttpCon->callbackPos is 0, the file is opened and as many bytes as possible are written. The current position is then saved to pHttpCon->callbackPos and the file is closed. On sobsequent calls, reading begins at the saved location and continues. Once the end of the input file is reached, pHttpCon->callbackPos is set back to 0 to indicate completion.

Preconditions

None.

Parameters

ParametersDescription
connHandleHTTP connection handle.
cFileThe name of the file to be sent.

Returns

None.

Remarks

Users should not call this function directly,but should instead add dynamic variables in the form of inc:filename.ext in their HTML code to include the file at that specified location (for example, "filename.ext"). The mpfs2.jar utility will handle the rest.