CGIParameterType()

Syntax

Result = CGIParameterType(Name$ [, Index])
Description
Returns the type of the specified parameter.

Parameters

Name$ The name of the parameter to get the type. The parameter name is case-sensitive. CGIParameterName() can be used to get the name of a specified parameter. To get the number of available parameters, use CountCGIParameters().
Index (optional) The index of the parameter to get the type. The first index value starts from 0. If specified, the 'Name$' parameter value is ignored (excepts if sets to #PB_Ignore).

Return value

Returns the type of the specified parameter. It can be one of the following value:
  #PB_CGI_Text: the parameter is a string
  #PB_CGI_File: the parameter is a binary file. CGIParameterValue() will returns the original filename
                and CGIParameterData() can be used to retrieve the binary data.

Example

  If Not InitCGI() Or Not ReadCGI()
    End
  EndIf
  
  WriteCGIHeader(#PB_CGI_HeaderContentType, "text/html", #PB_CGI_LastHeader) ; Write the headers to inform the browser of the content format
  
  WriteCGIString("<html><title>PureBasic - parameters</title><body>" +
                 "NbParameters: " + CountCGIParameters() + "<br><br>")
  
  ; List the all parameters and display their name
  ;
  For k = 0 To CountCGIParameters()-1
    If CGIParameterType("", k) = #PB_CGI_File
      WriteCGIString("[File] "+CGIParameterName(k)+" (filename: "+CGIParameterValue("", k)+")<br>")
    Else
      WriteCGIString("[String] "+CGIParameterName(k)+" (value: "+CGIParameterValue("", k)+")<br>")
    EndIf
  Next
  
  WriteCGIString("</body></html>")

See Also

CGIParameterName(), CGIParameterValue(), CGIParameterData(), CGIParameterDataSize()

Supported OS

All

<- CGIParameterName() - CGI Index - CGIParameterValue() ->