Retrieves a file uploaded with HTTP file upload into a binary string.

Use GetMultipartFiles instead

We recommend you use GetMultipartFiles instead of this function to allow retrieving multi-file selections to the same key name.

HTTP file uploads and multipart forms are sent up to server with multipart forms which are submitted in an HTML page as follows:

<form action="FileUpload.wwd" method="POST" **enctype="multipart/form-data"**>
     <input type="file"  name="File" id="File">
      <strong>File Description:</strong>
      <textarea rows="4" name="txtFileNotes" cols="43"></textarea>
      <input type="submit" value="Upload File" name="btnSubmit">
o.GetMultipartFile(lcKey, lcFileName)

Return Value

String that contains binary image of the file. Use STRTOFILE() to save the file to disk.


The name of the file to retrieve

Optional - a string that will be filled with the file's name. must be passed by reference. Initial value is ignored.


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)
*** Now dump the file to disk

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::GetMultiPartFiles | wwRequest::Form

© West Wind Technologies, 1996-2019 • Updated: 10/26/2015
Comment or report problem with topic