Quick Nav
Upload ExampleSee Also
ESP OverviewHow ESP Works
Standard Environment
Creating Dynamic Web Pages
Creating Forms
Session State
ESP Reference
File Upload
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.
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.
The objects in files[] contain the following properties:
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:<FORM method="post" action="upload.esp" enctype="multipart/form-data">
<P>
File
<input type="hidden" name="MAX_FILE_SIZE" value="30000">
<input type="file" name="logoFile">
<input type="submit" value="send">
<input type="reset" value="cancel">
</P>
</FORM>
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.
<p>Local temporary file name : @@files['logoFile'].FILENAME</p>
<p>Client file name : @@files['logoFile'].CLIENT_FILENAME</p>
<p>Size of file : @@files['logoFile'].SIZE</p>
You can also iterate over all elements of the files[] array using the for/in statement. For
example:
<%
for (var f in files) {
write("<p>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.
- SIZE - Size of the uploaded file in bytes.