我只是照搬过来的,我也是刚找到。我自己还没看明白源码呢。:)<br> 你只有自己修改了。我把整个网页一起贴过来吧。谁英文好翻译一下。<br> 一页贴不下,分两页。<br> Upload Form<br> Usually, you use an HTML FORM to submit data from the browser to the web server. That form can contain text fields, checkbox, button and also a file type control to upload files. The user fills in the form with his data and submits the form to the server.<br> <br> The enctype attribute of the <FORM> element specifies the content type used to encode the form data set for submission to the server. The enctype attribute used by default is " application/x-www-form-urlencoded ". However, that enctype is inefficient for sending large quantities of text, text containing non-ASCII characters or binary data to the server. The content type " multipart/form-data " should be used to submit forms in case of file uploading. Actually, it can be used to submit files and binary data. <br> <br> A " multipart/form-data " message contains a series of parts, where each part is expected to contain: <br> <br> a Content-Disposition header whose value is " form-data " <br> a name attribute specifying the control name. <br> For a file type control, the part contains some more information:<br> <br> a filename attribute specifying the original path and file name on the client <br> a Content-Type header of the binary data control sent. <br> Those headers are followed by the binary or text content of the control.<br> <br> The following example illustrates " multipart/form-data " encoding. The client would have this form in the browser: <br> <br> <FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="upload.asp"><br> <INPUT TYPE="Text" NAME="email" VALUE="PhCollignon@email.com"><BR><br> <INPUT TYPE="file" NAME="blob"><BR><br> <INPUT TYPE="submit" NAME="Enter"><br> </FORM><br> <br> <br> <br> If this form is submitted, the following request can be read on the server:<br> <br> -----------------------------7cf87224d2020a <br> Content-Disposition: form-data; name="email" <br> <br> PhCollignon@email.com<br> -----------------------------7cf87224d2020a<br> Content-Disposition: form-data; name="blob"; filename="c:\image.gif"<br> Content-Type: image/pjpeg <br> <br> ÿØÿàJFIFHHÿÛC…<br> …ÿÙ <br> -----------------------------7cf87224d2020a <br> Content-Disposition: form-data; name="Enter" <br> <br> Submit Query <br> -----------------------------7cf87224d2020a-- <br> <br> That content can be displayed if it is sent back as a response to the client. The binary data should be read and written with Request.binaryRead and Response.binaryWrite methods.<br> <br> <%<br> Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes))<br> %><br> <br> You can see that parts of the response are delimited by boundaries:<br> <br> -----------------------------7cf87224d2020a<br> <br> and the last boundary is followed by: ' -- ' <br> <br> <br> There is one Content-Disposition for each control. The name attribute identifies the control sent by the HTML form (email, blob and Enter). For a file type control (blob), the file name is also part of Content-Disposition header and, a Content-Type header gives the content type of the binary data. <br> <br>
|