2013년 6월 16일 일요일

Form-based File Upload in HTML

0. form-based file upload는 어디에 정의 되어 있을까?

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. 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.

 2. HTML forms with file submission
 - 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.
(POST form data의 default mime type 인 application/x-www-form-urlencoded 은 큰 바이너리 데이터나, non-ASCII 문자열을 전송하기에 비효율적이다)

 - example
<form action="_URL_" enctype="multipart/form-data" method="POST">
    File to process: <input name="userfile1" type="file" />
    <input type="submit" value="Send File" />
</form>

* ref
http://www.faqs.org/rfcs/rfc1867.html
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2

댓글 없음:

댓글 쓰기