LoadReqFile

Has no parameters

Description:

When processing an HTTP POST Request that contains multipart/form-data with multiple files, and if the data size exceeds the configured RAMRecvSize, and if the hidden form field named Multipart.Form-Data.Proc is set to Raw, the contents of the file referenced by Req.FileName is parsed into the Work Query.

This command applies WebSafe$ to all form field names and to all form data that is not an uploaded file.

Note that the runtime memory is able to store and manipulate binary data in memory. If any binary data is to be saved into the Database with characters of an ASCII value of 0 or 1, the data must first be encoded using the Plus8Encode command.

See also: LoadMultipart as an alternative approach to loading multipart/form-data into the Work Query when the complete contents of the multiple files needs to be inspected or modified before parsing into the Work Query, or if the data comes from a source other than Req.FileName.

Example:

Rem 'Init
  [Pull] Req.HasFile Req.FileSize Multipart.Form-Data.Proc
EndRem

Rem 'Get our Data
    Select Multipart.Form-Data.Proc
        Case "Raw"
            If Req.FileSize >> 20971520 '20MB as an example limit, set as appropriate for your application
                HttpStatus "400 Bad Request"
                Exit
            ElseIf Req.HasFile
              LoadReqFile
            Else
              CopyQuery "Me.Output", "Request"
            End If
        Case Else
            HttpStatus "400 Bad Request"
            Exit
    End Select
EndRem