Form-based File Upload in HTML
RFC 1867

Document Type RFC - Historic (November 1995; Errata)
Obsoleted by RFC 2854
Last updated 2013-03-02
Stream IETF
Formats plain text pdf htmlized with errata bibtex
Stream WG state (None)
Document shepherd No shepherd assigned
IESG IESG state RFC 1867 (Historic)
Consensus Boilerplate Unknown
Telechat date
Responsible AD (None)
Send notices to (None)
Network Working Group                                           E. Nebel
Request For Comments: 1867                                   L. Masinter
Category: Experimental                                 Xerox Corporation
                                                           November 1995

                     Form-based File Upload in HTML

Status of this Memo

   This memo defines an Experimental Protocol for the Internet
   community.  This memo does not specify an Internet standard of any
   kind.  Discussion and suggestions for improvement are requested.
   Distribution of this memo is unlimited.

1. Abstract

   Currently, HTML forms allow the producer of the form to request
   information from the user reading the form.  These forms have proven
   useful in a wide variety of applications in which input from the user
   is necessary.  However, this capability is limited because HTML forms
   don't provide a way to ask the user to submit files of data.  Service
   providers who need to get files from the user have had to implement
   custom user applications.  (Examples of these custom browsers have
   appeared on the www-talk mailing list.)  Since file-upload is a
   feature that will benefit many applications, this proposes an
   extension to HTML to allow information providers to express file
   upload requests uniformly, and a MIME compatible representation for
   file upload responses.  This also includes a description of a
   backward compatibility strategy that allows new servers to interact
   with the current HTML user agents.

   The proposal is independent of which version of HTML it becomes a
   part.

2.  HTML forms with file submission

   The current HTML specification defines eight possible values for the
   attribute TYPE of an INPUT element: CHECKBOX, HIDDEN, IMAGE,
   PASSWORD, RADIO, RESET, SUBMIT, TEXT.

   In addition, it defines the default ENCTYPE attribute of the FORM
   element using the POST METHOD to have the default value
   "application/x-www-form-urlencoded".

Nebel & Masinter              Experimental                      [Page 1]
RFC 1867             Form-based File Upload in HTML        November 1995

   This proposal makes two changes to HTML:

   1) Add a FILE option for the TYPE attribute of INPUT.
   2) Allow an ACCEPT attribute for INPUT tag, which is a list of
      media types or type patterns allowed for the input.

   In addition, it defines a new MIME media type, multipart/form-data,
   and specifies the behavior of HTML user agents when interpreting a
   form with ENCTYPE="multipart/form-data" and/or <INPUT type="file">
   tags.

   These changes might be considered independently, but are all
   necessary for reasonable file upload.

   The author of an HTML form who wants to request one or more files
   from a user would write (for example):

    <FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD=POST>

    File to process: <INPUT NAME="userfile1" TYPE="file">

    <INPUT TYPE="submit" VALUE="Send File">

    </FORM>

   The change to the HTML DTD is to add one item to the entity
   "InputType". In addition, it is proposed that the INPUT tag have an
   ACCEPT attribute, which is a list of comma-separated media types.

  ... (other elements) ...

  <!ENTITY % InputType "(TEXT | PASSWORD | CHECKBOX |
                         RADIO | SUBMIT | RESET |
                         IMAGE | HIDDEN | FILE )">
  <!ELEMENT INPUT - 0 EMPTY>
  <!ATTLIST INPUT
          TYPE %InputType TEXT
          NAME CDATA #IMPLIED  -- required for all but submit and reset
          VALUE CDATA #IMPLIED
          SRC %URI #IMPLIED  -- for image inputs --
          CHECKED (CHECKED) #IMPLIED
          SIZE CDATA #IMPLIED  --like NUMBERS,
                                  but delimited with comma, not space
          MAXLENGTH NUMBER #IMPLIED
          ALIGN (top|middle|bottom) #IMPLIED
          ACCEPT CDATA #IMPLIED --list of content types
          >

Nebel & Masinter              Experimental                      [Page 2]
RFC 1867             Form-based File Upload in HTML        November 1995

  ... (other elements) ...

3.  Suggested implementation

   While user agents that interpret HTML have wide leeway to choose the
   most appropriate mechanism for their context, this section suggests
   how one class of user agent, WWW browsers, might implement file
   upload.

3.1 Display of FILE widget

   When a INPUT tag of type FILE is encountered, the browser might show
   a display of (previously selected) file names, and a "Browse" button
   or selection method. Selecting the "Browse" button would cause the
   browser to enter into a file selection mode appropriate for the
   platform. Window-based browsers might pop up a file selection window,
   for example. In such a file selection dialog, the user would have the
   option of replacing a current selection, adding a new file selection,
   etc. Browser implementors might choose let the list of file names be
Show full document text