Declare Function ReadFile Lib "kernel32" _
(ByVal hFile As Long, _
lpBuffer As Any, _
ByVal nNumberOfBytesToRead As Long, _
lpNumberOfBytesRead As Long, _
lpOverlapped As Any) As Long
Sub GetFormData()
'====================================================
' Get the CGI data from STDIN and/or from QueryString
' Store name/value pairs
'====================================================
Dim sBuff As String ' buffer to receive POST method data
Dim rc As Long ' return code
' Method POST - get CGI data from STDIN
' Method GET - get CGI data from QueryString environment variable
'
If CGI_RequestMethod = "POST" Then
sBuff = String(lContentLength, Chr$(0))
rc = ReadFile(hStdIn, ByVal sBuff, lContentLength, lBytesRead, ByVal 0&)
sFormData = Left$(sBuff, lBytesRead)
' Make sure posted data is url-encoded
' Multipart content types, for example, are not necessarily encoded.
'
If InStr(1, CGI_ContentType, "www-form-urlencoded", 1) Then
StorePairs sFormData
End If
Else
'StorePairs CGI_QueryString
Call rep_error(16, "CGI Form Problem")
End
End If
End Sub