LoadMultipart

Takes two parameters, Data, Boundary

Usage:

Data, Boundary

Description:

Given Data that contains multipart/form-data and the specified Boundary used within that data, Data 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: LoadReqFile as the default approach to loading multipart/form-data into the Work Query from Req.FileName.

Example:

Rem 'Init
    [Pull] Req.HasFile Req.FileName Req.FileSize Req.Boundary 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
              [New] UploadFile = LoadFile$ Req.FileName
            Else
              [Pull] UploadFile 'Default Field name used by HtmlUpload
            End If
        Case Else
            HttpStatus "400 Bad Request"
            Exit
    End Select
EndRem

Rem 'Inspect and manipulate Data as needed here
    '...
EndRem

Rem 'Parse Req.Body into the Work Query
  LoadMultipart UploadFile, Req.Boundary
EndRem