欢迎光临
我们一直在努力

《无组件上传文件》

建站超值云服务器,限时71元/月

我只是照搬过来的,我也是刚找到。我自己还没看明白源码呢。:)<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 &lt;form&gt; element specifies the content type used to encode the form data set for submission to the server. the enctype attribute used by default is &quot; application/x-www-form-urlencoded &quot;. 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 &quot; multipart/form-data &quot; 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 &quot; multipart/form-data &quot; message contains a series of parts, where each part is expected to contain: <br>

<br>

a content-disposition header whose value is &quot; form-data &quot; <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 &quot; multipart/form-data &quot; encoding. the client would have this form in the browser: <br>

<br>

&lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; action=&quot;upload.asp&quot;&gt;<br>

&lt;input type=&quot;text&quot; name=&quot;email&quot; value=&quot;phcollignon@email.com&quot;&gt;&lt;br&gt;<br>

&lt;input type=&quot;file&quot; name=&quot;blob&quot;&gt;&lt;br&gt;<br>

&lt;input type=&quot;submit&quot; name=&quot;enter&quot;&gt;<br>

&lt;/form&gt;<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=&quot;email&quot; <br>

<br>

phcollignon@email.com<br>

—————————–7cf87224d2020a<br>

content-disposition: form-data; name=&quot;blob&quot;; filename=&quot;c:\image.gif&quot;<br>

content-type: image/pjpeg <br>

<br>

&yuml;&oslash;&yuml;àjfifhh&yuml;&ucirc;c…<br>

…&yuml;&ugrave; <br>

—————————–7cf87224d2020a <br>

content-disposition: form-data; name=&quot;enter&quot; <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>

&lt;%<br>

response.binarywrite(request.binaryread(request.totalbytes))<br>

%&gt;<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>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 《无组件上传文件》
分享到: 更多 (0)