Internet Direct (Indy)
Home
PreviousUpNext
TIdHTTPResponseInfo.ServeFile Method
Pascal
function ServeFile(
    AContext: TIdContext; 
    aFile: String
): cardinal; virtual;
Parameters 
Description 
AContext 
Client session of the HTTP response.
 
aFile 
File to be included in the HTTP response. 

Cardinal - Number of bytes in the file written in the HTTP response.

ServeFile is a virtual Cardinal function used to return the contents of the file specified in AFile in the HTTP response. 

AContent is the client session in the HTTP server handling the client request for the specified file. 

ServeFile allows the HTTP response to easily include the ContentType, ContentLength, and file content for the request file as part of the HTTP response written to the client connection. 

When ContentType contains an empty string (''), the MIMe type for the file is retrieved using the MIME table in the HTTPServer for the response. 

ContentLength is set to the length of the file using the FileSizeByName by function. 

ServeFile causes the HTTP headers to be written to the client connection for the HTTP session making the request, followed immediately by the content for the file specified in aFile.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.