﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-stevenhong-随笔分类-Java</title><link>http://www.blogjava.net/stevenhong/category/30697.html</link><description>若你喜欢怪人，其实我很美</description><language>zh-cn</language><lastBuildDate>Fri, 02 Jul 2010 15:03:39 GMT</lastBuildDate><pubDate>Fri, 02 Jul 2010 15:03:39 GMT</pubDate><ttl>60</ttl><item><title>jsp 出现getOutputStream() has already been called for this response的解决</title><link>http://www.blogjava.net/stevenhong/archive/2009/05/01/268460.html</link><dc:creator>stevenhong</dc:creator><author>stevenhong</author><pubDate>Fri, 01 May 2009 01:18:00 GMT</pubDate><guid>http://www.blogjava.net/stevenhong/archive/2009/05/01/268460.html</guid><description><![CDATA[<br />
&nbsp;详细请看 <a href="http://guoyiqi.javaeye.com/blog/75929">http://guoyiqi.javaeye.com/blog/75929</a><br />
&nbsp;主要是response.getOutputStream() 和 <span class="hilite8">response</span>.getWriter() 是互斥操作. 主要在JSP页面末尾加以下两句便可解决问题.<br />
&nbsp;<br />
<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: rgb(0, 0, 0);">&lt;%</span><span style="color: rgb(0, 0, 0);"><br />
&nbsp;&nbsp;out.clear();<br />
&nbsp;&nbsp;out&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;pageContext.pushBody();<br />
</span><span style="color: rgb(0, 0, 0);">%&gt;</span></div>
<img src ="http://www.blogjava.net/stevenhong/aggbug/268460.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/stevenhong/" target="_blank">stevenhong</a> 2009-05-01 09:18 <a href="http://www.blogjava.net/stevenhong/archive/2009/05/01/268460.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HttpURLConection 实现multipart/form-data</title><link>http://www.blogjava.net/stevenhong/archive/2008/05/17/183027.html</link><dc:creator>stevenhong</dc:creator><author>stevenhong</author><pubDate>Sat, 17 May 2008 06:08:00 GMT</pubDate><guid>http://www.blogjava.net/stevenhong/archive/2008/05/17/183027.html</guid><description><![CDATA[<p><span style="color: #0000ff"><strong>&nbsp;RFC1867<img border="0" alt="" src="http://www.blogjava.net/Emoticons/QQ/27.gif" width="20" height="20" /><br />
</strong></span><br />
<table style="font-size: x-small" border="0" cellspacing="2" cellpadding="2" width="500" bgcolor="#c0c0c0">
    <tbody>
        <tr>
            <td>Network Working Group&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; E. Nebel<br />
            Request For Comments: 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; L. Masinter<br />
            Category: Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Xerox Corporation<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995
            <p><br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML</p>
            <p>Status of this Memo</p>
            <p>&nbsp;&nbsp; This memo defines an Experimental Protocol for the Internet<br />
            &nbsp;&nbsp; community.&nbsp; This memo does not specify an Internet standard of any<br />
            &nbsp;&nbsp; kind.&nbsp; Discussion and suggestions for improvement are requested.<br />
            &nbsp;&nbsp; Distribution of this memo is unlimited.</p>
            <p>1. Abstract</p>
            <p>&nbsp;&nbsp; Currently, HTML forms allow the producer of the form to request<br />
            &nbsp;&nbsp; information from the user reading the form.&nbsp; These forms have proven<br />
            &nbsp;&nbsp; useful in a wide variety of applications in which input from the user<br />
            &nbsp;&nbsp; is necessary.&nbsp; However, this capability is limited because HTML forms<br />
            &nbsp;&nbsp; don't provide a way to ask the user to submit files of data.&nbsp; Service<br />
            &nbsp;&nbsp; providers who need to get files from the user have had to implement<br />
            &nbsp;&nbsp; custom user applications.&nbsp; (Examples of these custom browsers have<br />
            &nbsp;&nbsp; appeared on the www-talk mailing list.)&nbsp; Since file-upload is a<br />
            &nbsp;&nbsp; feature that will benefit many applications, this proposes an<br />
            &nbsp;&nbsp; extension to HTML to allow information providers to express file<br />
            &nbsp;&nbsp; upload requests uniformly, and a MIME compatible representation for<br />
            &nbsp;&nbsp; file upload responses.&nbsp; This also includes a description of a<br />
            &nbsp;&nbsp; backward compatibility strategy that allows new servers to interact<br />
            &nbsp;&nbsp; with the current HTML user agents.</p>
            <p>&nbsp;&nbsp; The proposal is independent of which version of HTML it becomes a<br />
            &nbsp;&nbsp; part.</p>
            <p>2.&nbsp; HTML forms with file submission</p>
            <p>&nbsp;&nbsp; The current HTML specification defines eight possible values for the<br />
            &nbsp;&nbsp; attribute TYPE of an INPUT element: CHECKBOX, HIDDEN, IMAGE,<br />
            &nbsp;&nbsp; PASSWORD, RADIO, RESET, SUBMIT, TEXT.</p>
            <p>&nbsp;&nbsp; In addition, it defines the default ENCTYPE attribute of the FORM<br />
            &nbsp;&nbsp; element using the POST METHOD to have the default value<br />
            &nbsp;&nbsp; "application/x-www-form-urlencoded".</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 1]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            &nbsp;&nbsp; This proposal makes two changes to HTML:</p>
            <p>&nbsp;&nbsp; 1) Add a FILE option for the TYPE attribute of INPUT.<br />
            &nbsp;&nbsp; 2) Allow an ACCEPT attribute for INPUT tag, which is a list of<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; media types or type patterns allowed for the input.</p>
            <p>&nbsp;&nbsp; In addition, it defines a new MIME media type, multipart/form-data,<br />
            &nbsp;&nbsp; and specifies the behavior of HTML user agents when interpreting a<br />
            &nbsp;&nbsp; form with ENCTYPE="multipart/form-data" and/or &lt;INPUT type="file"&gt;<br />
            &nbsp;&nbsp; tags.</p>
            <p>&nbsp;&nbsp; These changes might be considered independently, but are all<br />
            &nbsp;&nbsp; necessary for reasonable file upload.</p>
            <p>&nbsp;&nbsp; The author of an HTML form who wants to request one or more files<br />
            &nbsp;&nbsp; from a user would write (for example):</p>
            <p>&nbsp;&nbsp;&nbsp; &lt;FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD=POST&gt;</p>
            <p>&nbsp;&nbsp;&nbsp; File to process: &lt;INPUT NAME="userfile1" TYPE="file"&gt;</p>
            <p>&nbsp;&nbsp;&nbsp; &lt;INPUT TYPE="submit" VALUE="Send File"&gt;</p>
            <p>&nbsp;&nbsp;&nbsp; &lt;/FORM&gt;</p>
            <p>&nbsp;&nbsp; The change to the HTML DTD is to add one item to the entity<br />
            &nbsp;&nbsp; "InputType". In addition, it is proposed that the INPUT tag have an<br />
            &nbsp;&nbsp; ACCEPT attribute, which is a list of comma-separated media types.</p>
            <p>&nbsp; ... (other elements) ...</p>
            <p>&nbsp; &lt;!ENTITY % InputType "(TEXT | PASSWORD | CHECKBOX |<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RADIO | SUBMIT | RESET |<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMAGE | HIDDEN | FILE )"&gt;<br />
            &nbsp; &lt;!ELEMENT INPUT - 0 EMPTY&gt;<br />
            &nbsp; &lt;!ATTLIST INPUT<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE %InputType TEXT<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NAME CDATA #IMPLIED&nbsp; -- required for all but submit and reset<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VALUE CDATA #IMPLIED<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SRC %URI #IMPLIED&nbsp; -- for image inputs --<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHECKED (CHECKED) #IMPLIED<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE CDATA #IMPLIED&nbsp; --like NUMBERS,<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; but delimited with comma, not space<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MAXLENGTH NUMBER #IMPLIED<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALIGN (top|middle|bottom) #IMPLIED<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACCEPT CDATA #IMPLIED --list of content types<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;</p>
            <p>&nbsp;</p>
            <p><br />
            Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 2]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            &nbsp; ... (other elements) ...</p>
            <p>3.&nbsp; Suggested implementation</p>
            <p>&nbsp;&nbsp; While user agents that interpret HTML have wide leeway to choose the<br />
            &nbsp;&nbsp; most appropriate mechanism for their context, this section suggests<br />
            &nbsp;&nbsp; how one class of user agent, WWW browsers, might implement file<br />
            &nbsp;&nbsp; upload.</p>
            <p>3.1 Display of FILE widget</p>
            <p>&nbsp;&nbsp; When a INPUT tag of type FILE is encountered, the browser might show<br />
            &nbsp;&nbsp; a display of (previously selected) file names, and a "Browse" button<br />
            &nbsp;&nbsp; or selection method. Selecting the "Browse" button would cause the<br />
            &nbsp;&nbsp; browser to enter into a file selection mode appropriate for the<br />
            &nbsp;&nbsp; platform. Window-based browsers might pop up a file selection window,<br />
            &nbsp;&nbsp; for example. In such a file selection dialog, the user would have the<br />
            &nbsp;&nbsp; option of replacing a current selection, adding a new file selection,<br />
            &nbsp;&nbsp; etc. Browser implementors might choose let the list of file names be<br />
            &nbsp;&nbsp; manually edited.</p>
            <p>&nbsp;&nbsp; If an ACCEPT attribute is present, the browser might constrain the<br />
            &nbsp;&nbsp; file patterns prompted for to match those with the corresponding<br />
            &nbsp;&nbsp; appropriate file extensions for the platform.</p>
            <p>3.2 Action on submit</p>
            <p>&nbsp;&nbsp; When the user completes the form, and selects the SUBMIT element, the<br />
            &nbsp;&nbsp; browser should send the form data and the content of the selected<br />
            &nbsp;&nbsp; files.&nbsp; The encoding type application/x-www-form-urlencoded is<br />
            &nbsp;&nbsp; inefficient for sending large quantities of binary data or text<br />
            &nbsp;&nbsp; containing non-ASCII characters.&nbsp; Thus, a new media type,<br />
            &nbsp;&nbsp; multipart/form-data, is proposed as a way of efficiently sending the<br />
            &nbsp;&nbsp; values associated with a filled-out form from client to server.</p>
            <p>3.3 use of multipart/form-data</p>
            <p>&nbsp;&nbsp; The definition of multipart/form-data is included in section 7.&nbsp; A<br />
            &nbsp;&nbsp; boundary is selected that does not occur in any of the data. (This<br />
            &nbsp;&nbsp; selection is sometimes done probabilisticly.) Each field of the form<br />
            &nbsp;&nbsp; is sent, in the order in which it occurs in the form, as a part of<br />
            &nbsp;&nbsp; the multipart stream.&nbsp; Each part identifies the INPUT name within the<br />
            &nbsp;&nbsp; original HTML form. Each part should be labelled with an appropriate<br />
            &nbsp;&nbsp; content-type if the media type is known (e.g., inferred from the file<br />
            &nbsp;&nbsp; extension or operating system typing information) or as<br />
            &nbsp;&nbsp; application/octet-stream.</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 3]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            &nbsp;&nbsp; If multiple files are selected, they should be transferred together<br />
            &nbsp;&nbsp; using the multipart/mixed format.</p>
            <p>&nbsp;&nbsp; While the HTTP protocol can transport arbitrary BINARY data, the<br />
            &nbsp;&nbsp; default for mail transport (e.g., if the ACTION is a "mailto:" URL)<br />
            &nbsp;&nbsp; is the 7BIT encoding.&nbsp; The value supplied for a part may need to be<br />
            &nbsp;&nbsp; encoded and the "content-transfer-encoding" header supplied if the<br />
            &nbsp;&nbsp; value does not conform to the default encoding.&nbsp; [See section 5 of<br />
            &nbsp;&nbsp; RFC 1521 for more details.]</p>
            <p>&nbsp;&nbsp; The original local file name may be supplied as well, either as a<br />
            &nbsp;&nbsp; 'filename' parameter either of the 'content-disposition: form-data'<br />
            &nbsp;&nbsp; header or in the case of multiple files in a 'content-disposition:<br />
            &nbsp;&nbsp; file' header of the subpart. The client application should make best<br />
            &nbsp;&nbsp; effort to supply the file name; if the file name of the client's<br />
            &nbsp;&nbsp; operating system is not in US-ASCII, the file name might be<br />
            &nbsp;&nbsp; approximated or encoded using the method of RFC 1522.&nbsp; This is a<br />
            &nbsp;&nbsp; convenience for those cases where, for example, the uploaded files<br />
            &nbsp;&nbsp; might contain references to each other, e.g., a TeX file and its .sty<br />
            &nbsp;&nbsp; auxiliary style description.</p>
            <p>&nbsp;&nbsp; On the server end, the ACTION might point to a HTTP URL that<br />
            &nbsp;&nbsp; implements the forms action via CGI. In such a case, the CGI program<br />
            &nbsp;&nbsp; would note that the content-type is multipart/form-data, parse the<br />
            &nbsp;&nbsp; various fields (checking for validity, writing the file data to local<br />
            &nbsp;&nbsp; files for subsequent processing, etc.).</p>
            <p>3.4 Interpretation of other attributes</p>
            <p>&nbsp;&nbsp; The VALUE attribute might be used with &lt;INPUT TYPE=file&gt; tags for a<br />
            &nbsp;&nbsp; default file name. This use is probably platform dependent.&nbsp; It might<br />
            &nbsp;&nbsp; be useful, however, in sequences of more than one transaction, e.g.,<br />
            &nbsp;&nbsp; to avoid having the user prompted for the same file name over and<br />
            &nbsp;&nbsp; over again.</p>
            <p>&nbsp;&nbsp; The SIZE attribute might be specified using SIZE=width,height, where<br />
            &nbsp;&nbsp; width is some default for file name width, while height is the<br />
            &nbsp;&nbsp; expected size showing the list of selected files.&nbsp; For example, this<br />
            &nbsp;&nbsp; would be useful for forms designers who expect to get several files<br />
            &nbsp;&nbsp; and who would like to show a multiline file input field in the<br />
            &nbsp;&nbsp; browser (with a "browse" button beside it, hopefully).&nbsp; It would be<br />
            &nbsp;&nbsp; useful to show a one line text field when no height is specified<br />
            &nbsp;&nbsp; (when the forms designer expects one file, only) and to show a<br />
            &nbsp;&nbsp; multiline text area with scrollbars when the height is greater than 1<br />
            &nbsp;&nbsp; (when the forms designer expects multiple files).</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p><br />
            Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 4]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            4.&nbsp; Backward compatibility issues</p>
            <p>&nbsp;&nbsp; While not necessary for successful adoption of an enhancement to the<br />
            &nbsp;&nbsp; current WWW form mechanism, it is useful to also plan for a migration<br />
            &nbsp;&nbsp; strategy: users with older browsers can still participate in file<br />
            &nbsp;&nbsp; upload dialogs, using a helper application. Most current web browers,<br />
            &nbsp;&nbsp; when given &lt;INPUT TYPE=FILE&gt;, will treat it as &lt;INPUT TYPE=TEXT&gt; and<br />
            &nbsp;&nbsp; give the user a text box. The user can type in a file name into this<br />
            &nbsp;&nbsp; text box. In addition, current browsers seem to ignore the ENCTYPE<br />
            &nbsp;&nbsp; parameter in the &lt;FORM&gt; element, and always transmit the data as<br />
            &nbsp;&nbsp; application/x-www-form-urlencoded.</p>
            <p>&nbsp;&nbsp; Thus, the server CGI might be written in a way that would note that<br />
            &nbsp;&nbsp; the form data returned had content-type application/x-www-form-<br />
            &nbsp;&nbsp; urlencoded instead of multipart/form-data, and know that the user was<br />
            &nbsp;&nbsp; using a browser that didn't implement file upload.</p>
            <p>&nbsp;&nbsp; In this case, rather than replying with a "text/html" response, the<br />
            &nbsp;&nbsp; CGI on the server could instead send back a data stream that a helper<br />
            &nbsp;&nbsp; application might process instead; this would be a data stream of<br />
            &nbsp;&nbsp; type "application/x-please-send-files", which contains:</p>
            <p>&nbsp;&nbsp; * The (fully qualified) URL to which the actual form data should<br />
            &nbsp;&nbsp;&nbsp;&nbsp; be posted (terminated with CRLF)<br />
            &nbsp;&nbsp; * The list of field names that were supposed to be file contents<br />
            &nbsp;&nbsp;&nbsp;&nbsp; (space separated, terminated with CRLF)<br />
            &nbsp;&nbsp; * The entire original application/x-www-form-urlencoded form data<br />
            &nbsp;&nbsp;&nbsp;&nbsp; as originally sent from client to server.</p>
            <p>&nbsp;&nbsp; In this case, the browser needs to be configured to process<br />
            &nbsp;&nbsp; application/x-please-send-files to launch a helper application.</p>
            <p>&nbsp;&nbsp; The helper would read the form data, note which fields contained<br />
            &nbsp;&nbsp; 'local file names' that needed to be replaced with their data<br />
            &nbsp;&nbsp; content, might itself prompt the user for changing or adding to the<br />
            &nbsp;&nbsp; list of files available, and then repackage the data &amp; file contents<br />
            &nbsp;&nbsp; in multipart/form-data for retransmission back to the server.</p>
            <p>&nbsp;&nbsp; The helper would generate the kind of data that a 'new' browser<br />
            &nbsp;&nbsp; should actually have sent in the first place, with the intention that<br />
            &nbsp;&nbsp; the URL to which it is sent corresponds to the original ACTION URL.<br />
            &nbsp;&nbsp; The point of this is that the server can use the *same* CGI to<br />
            &nbsp;&nbsp; implement the mechanism for dealing with both old and new browsers.</p>
            <p>&nbsp;&nbsp; The helper need not display the form data, but *should* ensure that<br />
            &nbsp;&nbsp; the user actually be prompted about the suitability of sending the<br />
            &nbsp;&nbsp; files requested (this is to avoid a security problem with malicious<br />
            &nbsp;&nbsp; servers that ask for files that weren't actually promised by the</p>
            <p>&nbsp;</p>
            <p>Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 5]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            &nbsp;&nbsp; user.) It would be useful if the status of the transfer of the files<br />
            &nbsp;&nbsp; involved could be displayed.</p>
            <p>5.&nbsp; Other considerations</p>
            <p>5.1 Compression, encryption</p>
            <p>&nbsp;&nbsp; This scheme doesn't address the possible compression of files.&nbsp; After<br />
            &nbsp;&nbsp; some consideration, it seemed that the optimization issues of file<br />
            &nbsp;&nbsp; compression were too complex to try to automatically have browsers<br />
            &nbsp;&nbsp; decide that files should be compressed.&nbsp; Many link-layer transport<br />
            &nbsp;&nbsp; mechanisms (e.g., high-speed modems) perform data compression over<br />
            &nbsp;&nbsp; the link, and optimizing for compression at this layer might not be<br />
            &nbsp;&nbsp; appropriate. It might be possible for browsers to optionally produce<br />
            &nbsp;&nbsp; a content-transfer-encoding of x-compress for file data, and for<br />
            &nbsp;&nbsp; servers to decompress the data before processing, if desired; this<br />
            &nbsp;&nbsp; was left out of the proposal, however.</p>
            <p>&nbsp;&nbsp; Similarly, the proposal does not contain a mechanism for encryption<br />
            &nbsp;&nbsp; of the data; this should be handled by whatever other mechanisms are<br />
            &nbsp;&nbsp; in place for secure transmission of data, whether via secure HTTP or<br />
            &nbsp;&nbsp; mail.</p>
            <p>5.2 Deferred file transmission</p>
            <p>&nbsp;&nbsp; In some situations, it might be advisable to have the server validate<br />
            &nbsp;&nbsp; various elements of the form data (user name, account, etc.)&nbsp; before<br />
            &nbsp;&nbsp; actually preparing to receive the data.&nbsp; However, after some<br />
            &nbsp;&nbsp; consideration, it seemed best to require that servers that wish to do<br />
            &nbsp;&nbsp; this should implement this as a series of forms, where some of the<br />
            &nbsp;&nbsp; data elements that were previously validated might be sent back to<br />
            &nbsp;&nbsp; the client as 'hidden' fields, or by arranging the form so that the<br />
            &nbsp;&nbsp; elements that need validation occur first.&nbsp; This puts the onus of<br />
            &nbsp;&nbsp; maintaining the state of a transaction only on those servers that<br />
            &nbsp;&nbsp; wish to build a complex application, while allowing those cases that<br />
            &nbsp;&nbsp; have simple input needs to be built simply.</p>
            <p>&nbsp;&nbsp; The HTTP protocol may require a content-length for the overall<br />
            &nbsp;&nbsp; transmission. Even if it were not to do so, HTTP clients are<br />
            &nbsp;&nbsp; encouraged to supply content-length for overall file input so that a<br />
            &nbsp;&nbsp; busy server could detect if the proposed file data is too large to be<br />
            &nbsp;&nbsp; processed reasonably and just return an error code and close the<br />
            &nbsp;&nbsp; connection without waiting to process all of the incoming data.&nbsp; Some<br />
            &nbsp;&nbsp; current implementations of CGI require a content-length in all POST<br />
            &nbsp;&nbsp; transactions.</p>
            <p>&nbsp;&nbsp; If the INPUT tag includes the attribute MAXLENGTH, the user agent<br />
            &nbsp;&nbsp; should consider its value to represent the maximum Content-Length (in</p>
            <p>&nbsp;</p>
            <p>Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 6]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            &nbsp;&nbsp; bytes) which the server will accept for transferred files.&nbsp; In this<br />
            &nbsp;&nbsp; way, servers can hint to the client how much space they have<br />
            &nbsp;&nbsp; available for a file upload, before that upload takes place.&nbsp; It is<br />
            &nbsp;&nbsp; important to note, however, that this is only a hint, and the actual<br />
            &nbsp;&nbsp; requirements of the server may change between form creation and file<br />
            &nbsp;&nbsp; submission.</p>
            <p>&nbsp;&nbsp; In any case, a HTTP server may abort a file upload in the middle of<br />
            &nbsp;&nbsp; the transaction if the file being received is too large.</p>
            <p>5.3 Other choices for return transmission of binary data</p>
            <p>&nbsp;&nbsp; Various people have suggested using new mime top-level type<br />
            &nbsp;&nbsp; "aggregate", e.g., aggregate/mixed or a content-transfer-encoding of<br />
            &nbsp;&nbsp; "packet" to express indeterminate-length binary data, rather than<br />
            &nbsp;&nbsp; relying on the multipart-style boundaries.&nbsp; While we are not opposed<br />
            &nbsp;&nbsp; to doing so, this would require additional design and standardization<br />
            &nbsp;&nbsp; work to get acceptance of "aggregate".&nbsp; On the other hand, the<br />
            &nbsp;&nbsp; 'multipart' mechanisms are well established, simple to implement on<br />
            &nbsp;&nbsp; both the sending client and receiving server, and as efficient as<br />
            &nbsp;&nbsp; other methods of dealing with multiple combinations of binary data.</p>
            <p>5.4 Not overloading &lt;INPUT&gt;:</p>
            <p>&nbsp;&nbsp; Various people have wondered about the advisability of overloading<br />
            &nbsp;&nbsp; 'INPUT' for this function, rather than merely providing a different<br />
            &nbsp;&nbsp; type of FORM element.&nbsp; Among other considerations, the migration<br />
            &nbsp;&nbsp; strategy which is allowed when using &lt;INPUT&gt; is important.&nbsp; In<br />
            &nbsp;&nbsp; addition, the &lt;INPUT&gt; field *is* already overloaded to contain most<br />
            &nbsp;&nbsp; kinds of data input; rather than creating multiple kinds of &lt;INPUT&gt;<br />
            &nbsp;&nbsp; tags, it seems most reasonable to enhance &lt;INPUT&gt;.&nbsp; The 'type' of<br />
            &nbsp;&nbsp; INPUT is not the content-type of what is returned, but rather the<br />
            &nbsp;&nbsp; 'widget-type'; i.e., it identifies the interaction style with the<br />
            &nbsp;&nbsp; user.&nbsp; The description here is carefully written to allow &lt;INPUT<br />
            &nbsp;&nbsp; TYPE=FILE&gt; to work for text browsers or audio-markup.</p>
            <p>5.5 Default content-type of field data</p>
            <p>&nbsp;&nbsp; Many input fields in HTML are to be typed in. There has been some<br />
            &nbsp;&nbsp; ambiguity as to how form data should be transmitted back to servers.<br />
            &nbsp;&nbsp; Making the content-type of &lt;INPUT&gt; fields be text/plain clearly<br />
            &nbsp;&nbsp; disambiguates that the client should properly encode the data before<br />
            &nbsp;&nbsp; sending it back to the server with CRLFs.</p>
            <p>5.6 Allow form ACTION to be "mailto:"</p>
            <p>&nbsp;&nbsp; Independent of this proposal, it would be very useful for HTML<br />
            &nbsp;&nbsp; interpreting user agents to allow a ACTION in a form to be a</p>
            <p>&nbsp;</p>
            <p>Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 7]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            &nbsp;&nbsp; "mailto:" URL. This seems like a good idea, with or without this<br />
            &nbsp;&nbsp; proposal. Similarly, the ACTION for a HTML form which is received via<br />
            &nbsp;&nbsp; mail should probably default to the "reply-to:" of the message.<br />
            &nbsp;&nbsp; These two proposals would allow HTML forms to be served via HTTP<br />
            &nbsp;&nbsp; servers but sent back via mail, or, alternatively, allow HTML forms<br />
            &nbsp;&nbsp; to be sent by mail, filled out by HTML-aware mail recipients, and the<br />
            &nbsp;&nbsp; results mailed back.</p>
            <p>5.7 Remote files with third-party transfer</p>
            <p>&nbsp;&nbsp; In some scenarios, the user operating the client software might want<br />
            &nbsp;&nbsp; to specify a URL for remote data rather than a local file. In this<br />
            &nbsp;&nbsp; case, is there a way to allow the browser to send to the client a<br />
            &nbsp;&nbsp; pointer to the external data rather than the entire contents? This<br />
            &nbsp;&nbsp; capability could be implemented, for example, by having the client<br />
            &nbsp;&nbsp; send to the server data of type "message/external-body" with<br />
            &nbsp;&nbsp; "access-type" set to, say, "uri", and the URL of the remote data in<br />
            &nbsp;&nbsp; the body of the message.</p>
            <p>5.8 File transfer with ENCTYPE=x-www-form-urlencoded</p>
            <p>&nbsp;&nbsp; If a form contains &lt;INPUT TYPE=file&gt; elements but does not contain an<br />
            &nbsp;&nbsp; ENCTYPE in the enclosing &lt;FORM&gt;, the behavior is not specified.&nbsp; It<br />
            &nbsp;&nbsp; is probably inappropriate to attempt to URN-encode large quantities<br />
            &nbsp;&nbsp; of data to servers that don't expect it.</p>
            <p>5.9 CRLF used as line separator</p>
            <p>&nbsp;&nbsp; As with all MIME transmissions, CRLF is used as the separator for<br />
            &nbsp;&nbsp; lines in a POST of the data in multipart/form-data.</p>
            <p>5.10 Relationship to multipart/related</p>
            <p>&nbsp;&nbsp; The MIMESGML group is proposing a new type called multipart/related.<br />
            &nbsp;&nbsp; While it contains similar features to multipart/form-data, the use<br />
            &nbsp;&nbsp; and application of form-data is different enough that form-data is<br />
            &nbsp;&nbsp; being described separately.</p>
            <p>&nbsp;&nbsp; It might be possible at some point to encode the result of HTML forms<br />
            &nbsp;&nbsp; (including files) in a multipart/related body part; this is not<br />
            &nbsp;&nbsp; incompatible with this proposal.</p>
            <p>5.11 Non-ASCII field names</p>
            <p>&nbsp;&nbsp; Note that mime headers are generally required to consist only of 7-<br />
            &nbsp;&nbsp; bit data in the US-ASCII character set. Hence field names should be<br />
            &nbsp;&nbsp; encoded according to the prescriptions of RFC 1522 if they contain<br />
            &nbsp;&nbsp; characters outside of that set. In HTML 2.0, the default character</p>
            <p>&nbsp;</p>
            <p>Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 8]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            &nbsp;&nbsp; set is ISO-8859-1, but non-ASCII characters in field names should be<br />
            &nbsp;&nbsp; encoded.</p>
            <p>6. Examples</p>
            <p>&nbsp;&nbsp; Suppose the server supplies the following HTML:</p>
            <p><span style="color: #008000">&nbsp;<span style="color: #99ccff">&nbsp;<span style="color: #333399"><span style="color: #000080">&nbsp;&nbsp; &lt;FORM ACTION="http://server.dom/cgi/handle"<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENCTYPE="multipart/form-data"<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; METHOD=POST&gt;<br />
            &nbsp;&nbsp;&nbsp;&nbsp; What is your name? &lt;INPUT TYPE=TEXT NAME=submitter&gt;<br />
            &nbsp;&nbsp;&nbsp;&nbsp; What files are you sending? &lt;INPUT TYPE=FILE NAME=pics&gt;<br />
            &nbsp;&nbsp;&nbsp;&nbsp; &lt;/FORM&gt;</span></span></span></span></p>
            <p><span style="color: #008000"><span style="color: #99ccff"><span style="color: #333399"><span style="color: #000080">&nbsp;&nbsp; and the user types "Joe Blow" in the name field, and selects a text<br />
            &nbsp;&nbsp; file "file1.txt" for the answer to 'What files are you sending?'</span></span></span></span></p>
            <p><span style="color: #008000"><span style="color: #99ccff"><span style="color: #333399"><span style="color: #000080">&nbsp;&nbsp; The client might send back the following data:</span></span></span></span></p>
            <p><span style="color: #008000"><span style="color: #99ccff"><span style="color: #333399"><span style="color: #000080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Content-type: multipart/form-data, boundary=AaB03x</span></span></span></span></p>
            <p><span style="color: #008000"><span style="color: #99ccff"><span style="color: #333399"><span style="color: #000080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --AaB03x<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; content-disposition: form-data; name="field1"</span></span></span></span></p>
            <p><span style="color: #008000"><span style="color: #99ccff"><span style="color: #333399"><span style="color: #000080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Joe Blow<br />
            <span style="color: #ff0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --AaB03x<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; content-disposition: form-data; name="pics"; filename="file1.txt"<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Content-Type: text/plain</span></span></span></span></span></p>
            <p><span style="color: #008000"><span style="color: #99ccff"><span style="color: #333399"><span style="color: #000080"><span style="color: #ff0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... contents of file1.txt ...</span><br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --AaB03x--</span></span></span></span></p>
            <p>&nbsp;&nbsp; If the user also indicated an image file "file2.gif" for the answer<br />
            &nbsp;&nbsp; to 'What files are you sending?', the client might client might send<br />
            &nbsp;&nbsp; back the following data:</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Content-type: multipart/form-data, boundary=AaB03x</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --AaB03x<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; content-disposition: form-data; name="field1"</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Joe Blow<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --AaB03x<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; content-disposition: form-data; name="pics"<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Content-type: multipart/mixed, boundary=BbC04y</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --BbC04y<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Content-disposition: attachment; filename="file1.txt"</p>
            <p>&nbsp;</p>
            <p>Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 9]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Content-Type: text/plain</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... contents of file1.txt ...<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --BbC04y<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Content-disposition: attachment; filename="file2.gif"<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Content-type: image/gif<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Content-Transfer-Encoding: binary</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...contents of file2.gif...<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --BbC04y--<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --AaB03x--</p>
            <p>7. Registration of multipart/form-data</p>
            <p>&nbsp;&nbsp; The media-type multipart/form-data follows the rules of all multipart<br />
            &nbsp;&nbsp; MIME data streams as outlined in RFC 1521. It is intended for use in<br />
            &nbsp;&nbsp; returning the data that comes about from filling out a form. In a<br />
            &nbsp;&nbsp; form (in HTML, although other applications may also use forms), there<br />
            &nbsp;&nbsp; are a series of fields to be supplied by the user who fills out the<br />
            &nbsp;&nbsp; form. Each field has a name. Within a given form, the names are<br />
            &nbsp;&nbsp; unique.</p>
            <p>&nbsp;&nbsp; multipart/form-data contains a series of parts. Each part is expected<br />
            &nbsp;&nbsp; to contain a content-disposition header where the value is "form-<br />
            &nbsp;&nbsp; data" and a name attribute specifies the field name within the form,<br />
            &nbsp;&nbsp; e.g., 'content-disposition: form-data; name="xxxxx"', where xxxxx is<br />
            &nbsp;&nbsp; the field name corresponding to that field. Field names originally in<br />
            &nbsp;&nbsp; non-ASCII character sets may be encoded using the method outlined in<br />
            &nbsp;&nbsp; RFC 1522.</p>
            <p>&nbsp;&nbsp; As with all multipart MIME types, each part has an optional Content-<br />
            &nbsp;&nbsp; Type which defaults to text/plain.&nbsp; If the contents of a file are<br />
            &nbsp;&nbsp; returned via filling out a form, then the file input is identified as<br />
            &nbsp;&nbsp; application/octet-stream or the appropriate media type, if known.&nbsp; If<br />
            &nbsp;&nbsp; multiple files are to be returned as the result of a single form<br />
            &nbsp;&nbsp; entry, they can be returned as multipart/mixed embedded within the<br />
            &nbsp;&nbsp; multipart/form-data.</p>
            <p>&nbsp;&nbsp; Each part may be encoded and the "content-transfer-encoding" header<br />
            &nbsp;&nbsp; supplied if the value of that part does not conform to the default<br />
            &nbsp;&nbsp; encoding.</p>
            <p>&nbsp;&nbsp; File inputs may also identify the file name. The file name may be<br />
            &nbsp;&nbsp; described using the 'filename' parameter of the "content-disposition"<br />
            &nbsp;&nbsp; header. This is not required, but is strongly recommended in any case<br />
            &nbsp;&nbsp; where the original filename is known. This is useful or necessary in<br />
            &nbsp;&nbsp; many applications.</p>
            <p>&nbsp;</p>
            <p><br />
            Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 10]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            8. Security Considerations</p>
            <p>&nbsp;&nbsp; It is important that a user agent not send any file that the user has<br />
            &nbsp;&nbsp; not explicitly asked to be sent. Thus, HTML interpreting agents are<br />
            &nbsp;&nbsp; expected to confirm any default file names that might be suggested<br />
            &nbsp;&nbsp; with &lt;INPUT TYPE=file VALUE="yyyy"&gt;.&nbsp; Never have any hidden fields be<br />
            &nbsp;&nbsp; able to specify any file.</p>
            <p>&nbsp;&nbsp; This proposal does not contain a mechanism for encryption of the<br />
            &nbsp;&nbsp; data; this should be handled by whatever other mechanisms are in<br />
            &nbsp;&nbsp; place for secure transmission of data, whether via secure HTTP, or by<br />
            &nbsp;&nbsp; security provided by MOSS (described in RFC 1848).</p>
            <p>&nbsp;&nbsp; Once the file is uploaded, it is up to the receiver to process and<br />
            &nbsp;&nbsp; store the file appropriately.</p>
            <p>9.&nbsp; Conclusion</p>
            <p>&nbsp;&nbsp; The suggested implementation gives the client a lot of flexibility in<br />
            &nbsp;&nbsp; the number and types of files it can send to the server, it gives the<br />
            &nbsp;&nbsp; server control of the decision to accept the files, and it gives<br />
            &nbsp;&nbsp; servers a chance to interact with browsers which do not support INPUT<br />
            &nbsp;&nbsp; TYPE "file".</p>
            <p>&nbsp;&nbsp; The change to the HTML DTD is very simple, but very powerful.&nbsp; It<br />
            &nbsp;&nbsp; enables a much greater variety of services to be implemented via the<br />
            &nbsp;&nbsp; World-Wide Web than is currently possible due to the lack of a file<br />
            &nbsp;&nbsp; submission facility.&nbsp; This would be an extremely valuable addition to<br />
            &nbsp;&nbsp; the capabilities of the World-Wide Web.</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p><br />
            Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 11]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            Authors' Addresses</p>
            <p>&nbsp;&nbsp; Larry Masinter<br />
            &nbsp;&nbsp; Xerox Palo Alto Research Center<br />
            &nbsp;&nbsp; 3333 Coyote Hill Road<br />
            &nbsp;&nbsp; Palo Alto, CA 94304</p>
            <p>&nbsp;&nbsp; Phone:&nbsp; (415) 812-4365<br />
            &nbsp;&nbsp; Fax:&nbsp;&nbsp;&nbsp; (415) 812-4333<br />
            &nbsp;&nbsp; EMail:&nbsp;&nbsp; masinter@parc.xerox.com</p>
            <p><br />
            &nbsp;&nbsp; Ernesto Nebel<br />
            &nbsp;&nbsp; XSoft, Xerox Corporation<br />
            &nbsp;&nbsp; 10875 Rancho Bernardo Road, Suite 200<br />
            &nbsp;&nbsp; San Diego, CA 92127-2116</p>
            <p>&nbsp;&nbsp; Phone:&nbsp; (619) 676-7817<br />
            &nbsp;&nbsp; Fax:&nbsp;&nbsp;&nbsp; (619) 676-7865<br />
            &nbsp;&nbsp; EMail:&nbsp;&nbsp; nebel@xsoft.sd.xerox.com</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 12]<br />
            <br />
            RFC 1867&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form-based File Upload in HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; November 1995</p>
            <p><br />
            A. Media type registration for multipart/form-data</p>
            <p>Media Type name:<br />
            &nbsp;multipart</p>
            <p>Media subtype name:<br />
            &nbsp;form-data</p>
            <p>Required parameters:<br />
            &nbsp;none</p>
            <p>Optional parameters:<br />
            &nbsp;none</p>
            <p>Encoding considerations:<br />
            &nbsp;No additional considerations other than as for other multipart types.</p>
            <p>Published specification:<br />
            &nbsp;RFC 1867</p>
            <p>Security Considerations</p>
            <p>&nbsp; The multipart/form-data type introduces no new security<br />
            &nbsp; considerations beyond what might occur with any of the enclosed<br />
            &nbsp; parts.</p>
            <p>References</p>
            <p>[RFC 1521] MIME (Multipurpose Internet Mail Extensions) Part One:<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mechanisms for Specifying and Describing the Format of<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Internet Message Bodies.&nbsp; N. Borenstein &amp; N. Freed.<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; September 1993.</p>
            <p>[RFC 1522] MIME (Multipurpose Internet Mail Extensions) Part Two:<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Message Header Extensions for Non-ASCII Text. K. Moore.<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; September 1993.</p>
            <p>[RFC 1806] Communicating Presentation Information in Internet<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Messages: The Content-Disposition Header. R. Troost &amp; S.<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dorner, June 1995.</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>Nebel &amp; Masinter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Experimental&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 13]<br />
            <br />
            </p>
            </td>
        </tr>
    </tbody>
</table>
</p>
<img src ="http://www.blogjava.net/stevenhong/aggbug/183027.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/stevenhong/" target="_blank">stevenhong</a> 2008-05-17 14:08 <a href="http://www.blogjava.net/stevenhong/archive/2008/05/17/183027.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>