Each part is expected to contain:
1. a "Content-Disposition" header whose value is "form-data".
2. a name attribute specifying the control name [p.208] of the corresponding control. Control names
originally encoded in non-ASCII character sets [p.37] may be encoded using the method outlined in
[RFC2045] [p.328] .
Thus, for example, for a control named "mycontrol", the corresponding part would be specified:
Content-Disposition: form-data; name="mycontrol"
As with all MIME transmissions, "CR LF" (i.e., `%0D%0A') is used to separate lines of data.
Each part may be encoded and the "Content-Transfer-Encoding" header supplied if the value of that part
does not conform to the default (7BIT) encoding (see [RFC2045] [p.328] , section 6)
If the contents of a file are submitted with a form, the file input should be identified by the appropriate
content type [p.46] (e.g., "application/octet-stream"). If multiple files are to be returned as the result of a
single form entry, they should be returned as "multipart/mixed" embedded within the
The user agent should attempt to supply a file name for each submitted file. The file name may be
specified with the "filename" parameter of the 'Content-Disposition: form-data' header, or, in the case of
multiple files, in a 'Content-Disposition: file' header of the subpart. If the file name of the client's
operating system is not in US-ASCII, the file name might be approximated or encoded using the method
of [RFC2045] [p.328] . This is convenient for those cases where, for example, the uploaded files might
contain references to each other (e.g., a TeX file and its ".sty" auxiliary style description).
The following example illustrates "multipart/form-data" encoding. Suppose we have the following form:
What is your name? <INPUT type="text" name="submit-name"><BR>
What files are you sending? <INPUT type="file" name="files"><BR>
<INPUT type="submit" value="Send"> <INPUT type="reset">
If the user enters "Larry" in the text input, and selects the text file "file1.txt", the user agent might send
back the following data:
Content-Type: multipart/form-data; boundary=AaB03x
Content-Disposition: form-data; name="submit-name"
Content-Disposition: form-data; name="files"; filename="file1.txt"
17.13.4 Form content types