Most browsers support file upload using the RFC-1867 specification. This allows files to be encoded using multipart/mime and submitted using the HTTP POST method. Web servers supporting file upload should decode the files and store them locally before allowing CGI, PHP, ESP or equivalent mechanisms to access and manage the uploaded files.
AppWeb supports the file uploadfor browsers that support the RFC-1867 specification. Embedded Server Pages and PHP provide access to the uploaded files. This documentation will focus on ESP access to uploaded files. Consult PHP documentation for access using PHP. Currently the WebServer ESP implementation does not support file upload.
When files are uploaded, they are created in a temporary holding directory on disk. The location of the upload directory is defined by the FileUploadDir configuration directive. For each uploaded file, an object entry in the ESP files[] array will be created. The name of these objects is given by the upload field name in the ESP page.
Upload Example
For example, the following HTML page:
This HTML fragment will allow a file to be uploaded containing, say a Company's logo. The recieving ESP page could then access the uploaded file.
Local temporary file name : @@files['logoFile'].FILENAME
Client file name : @@files['logoFile'].CLIENT_FILENAME
Size of file : @@files['logoFile'].SIZE
You can also iterate over all elements of the files[] array using the for/in statement. For example:
<% for (var f in files) { write("
Size of " + f + " = " files[f].SIZE); } %>
The objects in files[] contain the following properties:
CLIENT_FILENAME - Name of the uploaded file given by the client.
CONTENT_TYPE - Type of the encoded data.
FILENAME - Local name of the temporary file in the upload directory.