Method Html3():getFile() Professional

![B:0355] Get the content of a file that was uploaded to the WAA server.

:getFile( <cFilename> | <cVarName> ) --> cFileContents | NIL
<cFilename> is the filename of the file uploaded to the WAA server.
<cVarName> is the name of the file uploaded to the WAA server.

The method returns the contents of the file that was uploaded to the server.


Retrieving a file that was uploaded to the WAA server must be accomplished in two steps: first, retrieve the filename using the method :getVar(), then use this method to retrieve the file's contents.

Note that the encoding of the HTML form must have been specified as "multipart/form-data" in order to transfer the file contents.

Code of the HTML form:

<FORM ACTION="/cgi-bin/waa1gate.exe" METHOD=post 
  <INPUT TYPE=hidden NAME="WAA_FORM"    VALUE="My_Function"> 
  <INPUT TYPE=file   NAME="File1"       multiple> 
  <INPUT TYPE=submit VALUE="Caption"> 

PRG code to retrieve the file's contents:

xFileNames := oHTML:getVar( "File1" ) 

IF "C" == ValType( xFileNames ) 
   xFileNames := {xFileNames} 

// Successively retrieve the content of each file that 
// was uploaded. Note the "multiple" attribute in the 
// HTML, which allows to select multiple files in the 
// client browser. 
FOR nFileName := 1 TO Len( xFileNames ) 

  cFileName := xFileNames[nFileName] 

  cContents := oHTML:getFile( cFileName ) 

  // Todo: Process the contents of the file 



If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.