puts the fun newLISP button back in Lisp

File Upload via HTML and POST request


RFC 1867 introduces the possibility to upload files from a web browser in an HTML form via a HTTP POST request. This newLISP script implements the CGI script necessary to handle that request.

The following HTML form specifies an input type "file" which causes the web browser top display a [browse] button for bringing up a file dialog box on the clients system:

  <html>
  <head><TITLE>File Upload</TITLE></head>

  <body>

  <h2>Upload File</font></h2>
  <form name="FileUpload" action="upload.cgi" 
                          method="POST" enctype="multipart/form-data">
  <input type="file" name="uploaded_data" size="40">
  <input type="submit" value="Upload" name="submit">
  </form>

  </body>
  </html>

click here for a demo

The important part is the encoding type "multipart/form-data" and the input type of the form "file". The following CGI script will process the request and put the file in the same directory of the upload.cgi script:

click here for upload.cgi

The script has been tested on the FireFox, MS IE and Konqueror web browsers and the Apache web server. newLISP v.10.1 or later is required to run this script.