WriteCGIFile()

Syntax

Result = WriteCGIFile(Filename$)
Description
Writes a whole file to the CGI output. When sending binary data, the 'content-type' header should be set to 'application/octet-stream'.

Parameters

Filename$ The file to write to the CGI output.

Return value

Returns non-zero if the file has been successfully written to the CGI output.

Example

  If Not InitCGI() Or Not ReadCGI()
    End
  EndIf
  
  WriteCGIHeader(#PB_CGI_HeaderContentType, "application/octet-stream")
  WriteCGIHeader(#PB_CGI_HeaderContentDisposition, "attachment; filename=test.bmp", #PB_CGI_LastHeader)
  
  WriteCGIFile(#PB_Compiler_Home + "examples/sources/data/PureBasic.bmp")

See Also

InitCGI(), WriteCGIHeader()

Supported OS

All

<- WriteCGIData() - CGI Index - WriteCGIHeader() ->