Next Previous Contents

2. Form uploads

It is possible to create a HTML upload form after RFC1867 and to send the form data in the following multipart message form to the server:

Content-Disposition: form-data; name="upfile"; filename="c:\rfc\rfc2068.html"
Content-Type: text/html
. . .
Content-Disposition: form-data; name="note"


A CGI program has to take the data and to write it again into a correct file.

2.1 HTML upload form

With the follwing form Netscape sends a multipart message of the above format to the server when you submit the form.

<form method='POST' enctype='multipart/form-data' action='/cgi-bin/'>
File to upload: <input type=file name=upfile><br>
Notes about the file: <input type=text name=note><br>
<input type=submit value=Press> to upload the file!

2.2 CGI program

The CGI program I wrote handles supplementary the following tasks:

  1. write the destination file
  2. write a .note file with remarks to the upload (date, source, destination, remote host, annotation, errors)
  3. write the annotations into the .desc file for the Pi3Web directory indexes
  4. redirect the upload data into a directory
  5. check for write permissions for the file

Contact the author to get the upload form CGI script for free.

2.3 SendFile handler in Pi3Web 2.0.0

The new SendFile handler, which is the default request handler of the server has build in capabilities in Pi3Web 2.0 to

2.4 Security

Since you can redirect the uploads into a directory the security risk is small. The .note files give the webmaster a history information of all uploads.

Next Previous Contents