19.6. Advanced CGI

We will now take a look at some of the more advanced aspects of CGI programming. These include: the use of cookies—cached data saved on the client side, multiple values for the same CGI field and file upload using multipart form submissions. To save space, we will show you all three of these features with a single application. Let's take a look at multipart submissions first.

19.6.1. Multipart Form Submission and File Uploading

Currently, the CGI specifications only allow two types of form encodings, “application/x-www-form-urlencoded” and “multipart/form-data.” Because “application/x-www-form-urlencoded” is the default, there is never a need to state the encoding in the FORM tag like this:

 <FORM enctype="application/x-www-form-urlencoded" ...

Get Core Python Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.