wwRequest::GetMultipartFormVar

Retrieves a multipart form variable from the request buffer. Multipart form variables are submitted on the client side by specifiying an encoding type of "multipart/form-data".

Multipart forms are inherently more efficient especially for large form submissions since the data is not encoded. Multi-part forms are also used for HTTP file uploads.

To create a multipart form add the following enctype attribute to your form:

<form ACTION="wc.dll?wwDemo~FileUpload" METHOD="POST" enctype="multipart/form-data">
     <font face="Verdana"><input TYPE="FILE" NAME="File">
      <br>
      <strong>File Description:</strong><br>
      <textarea rows="4" name="txtFileNotes" cols="43"></textarea><br>
      <input TYPE="submit" value="Upload File" name="btnSubmit"> </font></font></p>
</form>
o.GetMultipartFormVar(lcKey)

Return Value

String of the value retrieved. A null string if the var doesn't exist.

Parameters

lcKey
The multipart form variable to retrieve

Example


lcFileBuffer = Request.GetMultiPartFile("File",@lcFileName)
lcNotes = Request.GetMultipartFormVar("txtFileNotes")
lcFileName = SYS(2023)+"\"+lcFileName

IF LEN(lcFileBuffer) > 5000000
   THIS.StandardPage("File upload refused",;
                     "Files over 500k are not allowed for this sample...<BR>"+;
                     "File: " + lcFilename)
   RETURN
ENDIF
   
*** Now dump the file to disk
STRTOFILE(lcFilebuffer,lcFileName)

THIS.StandardPage("Thank you for your file upload",;
                  "<b>File Uploaded:</b> " + lcFileName + ;
                  " (" + TRANSFORM(FileSize(lcFileName),"9,999,999") + " bytes)<p>"+ ;
                  "<b>Notes:</b><br>"+ CRLF + lcNotes )

See also:

Class wwRequest | wwRequest::GetMultipartFile | wwRequest::Form

© West Wind Technologies, 1996-2018 • Updated: 09/06/99
Comment or report problem with topic