{"id":260,"date":"2011-02-24T12:09:38","date_gmt":"2011-02-24T03:09:38","guid":{"rendered":"http:\/\/www.prime-architect.co.jp\/myblog\/?p=260"},"modified":"2013-02-24T12:13:24","modified_gmt":"2013-02-24T03:13:24","slug":"multipartform-data%e3%81%a7%e3%81%ae%e6%96%87%e5%ad%97%e5%8c%96%e3%81%91%e5%af%be%e7%ad%96","status":"publish","type":"post","link":"https:\/\/www.prime-architect.co.jp\/myblog\/google-app-engine-260","title":{"rendered":"multipart\/form-data\u3067\u306e\u6587\u5b57\u5316\u3051\u5bfe\u7b56"},"content":{"rendered":"<p>Google App Engine\u3067\u753b\u50cf\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3001BigTable\u3078\u767b\u9332\u3059\u308b\u51e6\u7406\u306b\u3064\u3044\u3066\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.prime-architect.co.jp\/myblog\/google-app-engine-264 \">\u753b\u50cf\u3068\u4e00\u7dd2\u306b\u6587\u5b57\u5217\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u5834\u5408\u306e\u51e6\u7406\u306f\u524d\u56de\u66f8\u304d\u307e\u3057\u305f<\/a>\u3002<br \/>\n\u3057\u304b\u3057\u3001\u53d6\u5f97\u3057\u305f\u6587\u5b57\u5217\u304c\u65e5\u672c\u8a9e\u306a\u3069\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306e\u5834\u5408\u3001\u6587\u5b57\u5316\u3051\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u305d\u306e\u5bfe\u51e6\u306b\u3064\u3044\u3066\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u554f\u984c\u3092\u8272\u3005\u8abf\u3079\u3066\u89e3\u6c7a\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u89e3\u6c7a\u65b9\u6cd5\u3092\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u5099\u5fd8\u9332\u3068\u3057\u3066\u6b8b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u901a\u5e38\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6587\u5b57\u5217\u3092\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3059\u308b\u5834\u5408\u3001request.setCharacterEncoding(&#8220;UTF-8&#8221;)\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u304d\u308b\u3002<\/p>\n<p>\u3057\u304b\u3057\u306a\u304c\u3089\u3001\u3053\u308c\u306frequest.getParameter\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u5834\u5408\u3067\u306f\u6709\u52b9\u3060\u304c\u3001\u4eca\u56de\u306e\u3088\u3046\u306a\u30de\u30eb\u30c1\u30d1\u30fc\u30c8\u30c7\u30fc\u30bf\u3068\u3057\u3066\u53d6\u308a\u51fa\u3059\u5834\u5408\u306f\u901a\u7528\u3057\u306a\u3044\u3002<\/p>\n<p>\u5b9f\u969b\u306bsetCharacterEncoding\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\u3001&#8221;\u3042\u3042\u3042&#8221;\u3068\u3044\u3046\u6587\u5b57\u3092\u9001\u4fe1\u3059\u308b\u3068\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3055\u308c\u305a\u306b&#8221;\u00e3\u0081\u0082\u00e3\u0081\u0082\u00e3&#8221;\u3068\u3044\u3046\u3088\u3046\u306b\u6587\u5b57\u5316\u3051\u3057\u3066\u3057\u307e\u3046\u3002<\/p>\n<p>\u305d\u3053\u3067\u5225\u306e\u65b9\u6cd5\u3067\u6587\u5b57\u5316\u3051\u3092\u56de\u907f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3060\u3002<\/p>\n<p>\u3053\u306e\u6587\u5b57\u5316\u3051\u306f\u4ee5\u4e0b\u306e\u65b9\u6cd5\u3067\u5bfe\u51e6\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u305f\u3002<\/p>\n<p>\u53d6\u5f97\u3057\u305f\u6587\u5b57\u5217\u3092\u4e00\u5ea6\u30d0\u30a4\u30c8\u914d\u5217\u306b\u683c\u7d0d\u3059\u308b\u3002<br \/>\nbyte[] bytes= filetitle.getBytes(&#8220;iso-8859-1&#8221;)<\/p>\n<p>\u305d\u306e\u5f8c\u3001String\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067&#8221;utf-8&#8243;\u306b\u5fa9\u53f7\u5316\u3059\u308b\u3002<br \/>\nfiletitle = new String(bytes, &#8220;utf-8&#8221;);<\/p>\n<p>\u524d\u56de\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306e\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30bd\u30fc\u30b9\u3068\u306a\u308b\u3002<br \/>\nview\u5074<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;div style=&quot;BACKGROUND-COLOR: #ffffcc&quot;&gt;\r\n  &lt;form method=&quot;POST&quot; &lt;font color=&quot;#FA8072&quot;&gt;enctype=&quot;multipart\/form-data&quot;&lt;\/font&gt; action=&quot;\/imageup&quot;&gt;\r\n  &lt;input type=&quot;text&quot; name=&quot;filetitle&quot; \/&gt;\u3000\u2190\u30bf\u30a4\u30c8\u30eb\u540d\u306a\u3069\u306e\u6587\u5b57\u5217\r\n  &lt;input type=&quot;file&quot; size=&quot;30&quot; name=&quot;imgfile&quot; \/&gt;\u3000\u2190\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\r\n&lt;\/form&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p>\u30b5\u30fc\u30d0\u5074<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/\u30ea\u30af\u30a8\u30b9\u30c8\u30c7\u30fc\u30bf\u3092FileItem\u578b\u306e\u30ea\u30b9\u30c8\u306b\u683c\u7d0d\r\nList&lt;FileItem&gt; list = upload.parseRequest(req);\r\n\r\n\/\/\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u30c7\u30fc\u30bf\u3092\u9806\u306b\u51e6\u7406\uff08\u3053\u3053\u306fiterator\u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3082\u3002\u3002\u3002\uff09\r\nfor(FileItem item : list){\r\n \u3000\/\/\u753b\u50cf\u306e\u5834\u5408\u3001isFormFild\u304cFalse\u3068\u306a\u308b\u305f\u3081\u3001\u3053\u3053\u3067\u753b\u50cf\u306a\u306e\u304b\u3001\u901a\u5e38\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304b\u3092\u5224\u5225\u3059\u308b\u3002\r\n \u3000if(!(item.isFormField())){\r\n \u3000\/\/\u753b\u50cf\u3092\u30a2\u30c3\u30d7\u3059\u308b\u51e6\u7406\r\n   fileName = item.getName();\r\n\u3000\u3000\u3000\uff1a\r\n\u3000\u3000\u3000\uff1a\r\n\u3000\u3000\r\n \u3000}else {   \/\/\u901a\u5e38\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5834\u5408\u3001isFormFild\u304cTrue\u3068\u306a\u308b\u3002\r\n  \u3000\/\/\u3053\u3053\u3067\u3001\u30bf\u30a4\u30c8\u30eb\u540d\u3092\u53d6\u5f97\u3059\u308b\u3002getString\u30e1\u30bd\u30c3\u30c9\u3067\u7c21\u5358\u306b\u53d6\u5f97\u3067\u304d\u308b\u3002\r\n  \u3000filetitle = item.getString();\r\n\u3000\u3000filetitle = new String(filetitle.getBytes(&quot;iso-8859-1&quot;), &quot;utf-8&quot;);\r\n\u3000\u3000  \uff1a\r\n  \u3000\r\n \u3000}\r\n}\r\n<\/pre>\n<p><iframe src=\"http:\/\/rcm-jp.amazon.co.jp\/e\/cm?t=primearchitec-22&#038;o=9&#038;p=8&#038;l=as1&#038;asins=4798123021&#038;ref=qf_sp_asin_til&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google App Engine\u3067\u753b\u50cf\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3001BigTable\u3078\u767b\u9332\u3059\u308b\u51e6\u7406\u306b\u3064\u3044\u3066\u3067\u3059\u3002 \u753b\u50cf\u3068\u4e00\u7dd2\u306b\u6587\u5b57\u5217\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u5834\u5408\u306e\u51e6\u7406\u306f\u524d\u56de\u66f8\u304d\u307e\u3057\u305f\u3002 \u3057\u304b\u3057\u3001\u53d6\u5f97\u3057\u305f\u6587\u5b57\u5217\u304c\u65e5\u672c\u8a9e\u306a\u3069\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587 &hellip; <a href=\"https:\/\/www.prime-architect.co.jp\/myblog\/google-app-engine-260\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;multipart\/form-data\u3067\u306e\u6587\u5b57\u5316\u3051\u5bfe\u7b56&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[14],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.prime-architect.co.jp\/myblog\/wp-json\/wp\/v2\/posts\/260"}],"collection":[{"href":"https:\/\/www.prime-architect.co.jp\/myblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.prime-architect.co.jp\/myblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.prime-architect.co.jp\/myblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.prime-architect.co.jp\/myblog\/wp-json\/wp\/v2\/comments?post=260"}],"version-history":[{"count":12,"href":"https:\/\/www.prime-architect.co.jp\/myblog\/wp-json\/wp\/v2\/posts\/260\/revisions"}],"predecessor-version":[{"id":288,"href":"https:\/\/www.prime-architect.co.jp\/myblog\/wp-json\/wp\/v2\/posts\/260\/revisions\/288"}],"wp:attachment":[{"href":"https:\/\/www.prime-architect.co.jp\/myblog\/wp-json\/wp\/v2\/media?parent=260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.prime-architect.co.jp\/myblog\/wp-json\/wp\/v2\/categories?post=260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.prime-architect.co.jp\/myblog\/wp-json\/wp\/v2\/tags?post=260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}