{"id":692,"date":"2012-06-05T09:29:12","date_gmt":"2012-06-05T01:29:12","guid":{"rendered":"http:\/\/www.alextwl.idv.tw\/memo\/?p=692"},"modified":"2012-06-05T15:47:46","modified_gmt":"2012-06-05T07:47:46","slug":"asp-upload-files-without-com","status":"publish","type":"post","link":"https:\/\/www.alextwl.idv.tw\/memo\/2012\/06\/asp-upload-files-without-com\/","title":{"rendered":"\u4e0d\u7528\u53e6\u5916\u88dd COM \u5143\u4ef6\u7684 Classic ASP \u6a94\u6848\u4e0a\u50b3"},"content":{"rendered":"<p>\u90fd 2012 \u5e74\u4e86\u9084\u6c92\u6539\u7528 .NET \uff0c\u4e0d\u4f46\u9694\u58c1\u7cfb\u540c\u68af\u975e\u5e38\u4e0d\u4ee5\u70ba\u7136\uff0c\u5c31\u9023\u81ea\u5df1\u4e5f\u5f88\u610f\u5916\u6703\u56de\u982d\u5beb ASP&#8230; XD<\/p>\n<p>\u5e7e\u4e4e\u6240\u6709\u6559 ASP \u7684\u66f8\u5728\u6a94\u6848\u4e0a\u50b3\u4e00\u7bc0\uff0c\u90fd\u6703\u8981\u8b80\u8005\u52a0\u88dd\u4e00\u652f COM \u5143\u4ef6(\u5927\u591a\u662f\u66f8\u7c4d\u4f5c\u8005\u81ea\u5df1\u5beb\u7684 xxxUpload \u4e4b\u985e\u7684 COM)\uff0c\u518d\u900f\u904e CreateObject \u5e36\u9032\u4f86\u89e3 multipart\/form-data\uff0c\u65bc\u662f\u5beb\u4e00\u652f ASP \u6a94\u6848\u4e0a\u50b3\u7a0b\u5f0f\u8b8a\u5f97\u975e\u5e38\u7c21\u55ae\u3002\u554f\u984c\u662f\uff0c\u82e5\u7528\u7684\u662f\u5225\u4eba\u5bb6\u7684 Server\uff0c\u5c31\u5f97\u62dc\u8a17\u5e6b\u5fd9\u88dd COM\uff0c\u800c\u4e14\u4eba\u5bb6\u9084\u4e0d\u4e00\u5b9a\u6703\u7b54\u61c9\u3002<\/p>\n<p>\u65bc\u662f\u6709\u4eba\u5c31\u60f3\u5230\u62ff Request.BinaryRead \u81ea\u5df1\u89e3\u6574\u500b HTTP Request\u3002\u7db2\u8def\u4e0a\u80fd\u627e\u5230\u5f88\u591a\u5beb\u5f97\u5f88 dirty \u7684\u7bc4\u4f8b\uff0c\u4f46\u5927\u591a\u53ea\u80fd\u4e0a\u50b3\u4e00\u500b\u6a94\u6848\uff0c\u5f9e Header \u6488\u6a94\u540d\u7b49\u7b49\u6488\u6cd5\u4e5f\u5beb\u5f97\u4e0d\u662f\u5f88\u597d\u3002<\/p>\n<p>\u6700\u5f8c\u627e\u5230\u7684\u7d42\u6975\u89e3\u662f Lewis Moten \u5beb\u7684 <a href=\"http:\/\/www.planet-source-code.com\/vb\/scripts\/ShowCode.asp?txtCodeId=8525&#038;lngWId=4\">Upload Files Without COM v3<\/a> (clsUpload)\u3002\u9664\u4e86\u652f\u63f4\u591a\u6a94\u4e0a\u50b3\uff0c\u5b83\u5e7e\u4e4e\u628a\u53ef\u80fd\u7528\u5230\u7684\u6771\u897f\u90fd\u5beb\u597d\u5305\u6210\u4e00\u500b Class\uff0c\u4e5f\u70ba\u6c92\u8fa6\u6cd5\u7528 Request.Form \u7684\u554f\u984c\u89e3\u5957\u3002<\/p>\n<p>\u7b46\u8a18\u4e00\u4e0b\u9047\u5230\u7684\u554f\u984c\uff1a<\/p>\n<ol>\n<li>\u539f\u4f86\u7684 CStrU() \u5be6\u4f5c\u5f97\u4e0d\u597d\uff0c\u53ea\u8655\u7406 single byte ANSI character\uff0c\u5c0d\u5176\u4ed6\u7de8\u78bc\u662f\u500b\u707d\u96e3\u3002\u5efa\u8b70\u63db\u6210\u53e6\u4e00\u500b\u7248\u672c\uff1a<a href=\"http:\/\/stackoverflow.com\/questions\/1708822\/multipart-form-data-and-utf-8-in-a-asp-classic-application\">Multipart\/form-data and UTF-8 in a ASP Classic application &#8211; Stack Overflow<\/a>\u3002<\/li>\n<li>IIS 7.5 Content-Length \u7684\u554f\u984c\uff1a\u82e5\u5c07\u4e0a\u50b3\u7684\u6a94\u6848\u5b58\u5728\u8cc7\u6599\u5eab\uff0c\u52e2\u5fc5\u6703\u9700\u8981\u5beb\u53e6\u4e00\u96bb ASP \u5f9e\u8cc7\u6599\u5eab\u8b80\u6a94\uff0c\u7136\u5f8c\u518d\u7528 Response.BinaryWrite \u4e1f\u51fa\u53bb\u3002\u4ee5\u524d\u6211\u5011\u6703\u81ea\u5df1\u9001 Content-Length\uff0c\u4f46\u5728 IIS 7.5 \u5e95\u4e0b call Response.BinaryWrite \u6642\uff0cIIS \u6703\u5e6b\u5fd9\u7b97 Content-Length\uff0c\u82e5\u6211\u5011\u7684 ASP \u7a0b\u5f0f\u4e5f\u6709\u7528 Response.AddHeader \u4e1f\u4e00\u4efd Content-Length\uff0c\u5c31\u6703\u6574\u500b\u721b\u6389\u3002<br \/>\u6211\u4e0d\u78ba\u5b9a\u9019\u662f\u4e0d\u662f IIS 7.5 \u7684 Bug\u3001\u6216\u662f\u5be6\u4f5c\u4e0a\u6709\u6539\u8b8a\uff0cIIS 7.0 \u4ee5\u524d\u4e0d\u6703\u6709\u9019\u500b\u554f\u984c\u3002\u63db\u500b\u89d2\u5ea6\u770b\uff0c\u5176\u5be6\u9019\u500b\u7279\u6027\u4e5f\u9817\u8cbc\u5fc3\uff0c\u81f3\u5c11\u4e0d\u6703\u767c\u751f\u81ea\u5df1\u7b97\u932f Content-Length \u7684\u554f\u984c\u3002<br \/>\u9019\u53ef\u4ee5\u900f\u904e\u6aa2\u67e5 Request.ServerVariables(&#8220;SERVER_SOFTWARE&#8221;) \u662f\u5426\u70ba Microsoft-IIS\/7.5 \u4f86\u89e3\u6c7a\u3002<\/li>\n<li><del datetime=\"2012-06-05T07:56:19+00:00\">Client-side: \u642d\u914d <a href=\"http:\/\/www.plupload.com\/\">Plupload<\/a> \u4f86\u7528\u61c9\u8a72\u5f88\u4e0d\u932f&#8230;<\/del> \u9700\u8981\u53e6\u5916\u505a JSON-RPC&#8230;<\/li>\n<li>(\u8ddf clsUpload \u7121\u95dc\u7684\u8a71\u984c) \u73fe\u5728\u89ba\u5f97\u7528 GUID \u4e4b\u985e\u7684 identifier \u4f86\u7d22\u5f15\u8cc7\u6599\u5eab\u88cf\u982d\u7684\u6a94\u6848\u6bd4\u8d77 auto increment \u597d\u5f88\u591a\uff0c\u8b93\u5916\u4eba\u6c92\u8fa6\u6cd5\u8e39\u6578\u5b57\u4e82\u6293\u6a94\u6848\u3002\u53c3\u7167\uff1a<a href=\"http:\/\/support.microsoft.com\/kb\/320375\">HOW TO: Create GUIDs by Using Active Server Pages in IIS<\/a>\u3001<a href=\"http:\/\/stackoverflow.com\/questions\/968756\/how-to-generate-a-guid-in-vbscript\">How to generate a GUID in VBScript? &#8211; Stack Overflow<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u90fd 2012 \u5e74\u4e86\u9084\u6c92\u6539\u7528 .NET \uff0c\u4e0d\u4f46\u9694\u58c1\u7cfb\u540c\u68af\u975e\u5e38\u4e0d\u4ee5\u70ba\u7136\uff0c\u5c31\u9023\u81ea\u5df1\u4e5f\u5f88\u610f\u5916\u6703\u56de\u982d\u5beb ASP&#038;#823 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-692","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.alextwl.idv.tw\/memo\/wp-json\/wp\/v2\/posts\/692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.alextwl.idv.tw\/memo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.alextwl.idv.tw\/memo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.alextwl.idv.tw\/memo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alextwl.idv.tw\/memo\/wp-json\/wp\/v2\/comments?post=692"}],"version-history":[{"count":9,"href":"https:\/\/www.alextwl.idv.tw\/memo\/wp-json\/wp\/v2\/posts\/692\/revisions"}],"predecessor-version":[{"id":701,"href":"https:\/\/www.alextwl.idv.tw\/memo\/wp-json\/wp\/v2\/posts\/692\/revisions\/701"}],"wp:attachment":[{"href":"https:\/\/www.alextwl.idv.tw\/memo\/wp-json\/wp\/v2\/media?parent=692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.alextwl.idv.tw\/memo\/wp-json\/wp\/v2\/categories?post=692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.alextwl.idv.tw\/memo\/wp-json\/wp\/v2\/tags?post=692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}