{"id":1212,"date":"2012-06-21T16:15:02","date_gmt":"2012-06-21T07:15:02","guid":{"rendered":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/?p=1212"},"modified":"2016-08-29T10:03:47","modified_gmt":"2016-08-29T10:03:47","slug":"%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e3%82%a2%e3%83%83%e3%83%97%e3%83%ad%e3%83%bc%e3%83%89-jquery-upload","status":"publish","type":"post","link":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/?p=1212","title":{"rendered":"\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9 (jQuery.upload)"},"content":{"rendered":"<p>(text by kondo)<\/p>\n<p>\u30aa\u30fc\u30b5\u30ea\u30f3\u30b0\u30c4\u30fc\u30eb\u306e\u65b9\u3067\u3059\u304c\u3001\u753b\u50cf\u306e\u30d5\u30a1\u30a4\u30eb\u3084\u3001SCORM\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u6a5f\u80fd\u304c\u5fc5\u8981\u3067\u3059\u3002flash \u306e\u3068\u304d\u306b\u306f\u3001\u3068\u304f\u306b\u4f55\u3082\u305b\u305a\u306b flash \u306e\u6a5f\u80fd\u3067\u53ef\u80fd\u3067\u3057\u305f\u304c\u3001HTML\u3068javascript\u3067\u306f\u3001\u3082\u3068\u3082\u3068\u3042\u308bform\u306e\u6a5f\u80fd\u3067\u306f\u3001\u753b\u9762\u304c\u5207\u308a\u66ff\u308f\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u305d\u308c\u3067\u306f\u4e0d\u90fd\u5408\u306a\u306e\u3067\u3001jQuery\u306e\u30d7\u30e9\u30b0\u30a4\u30f3(jQuery.upload)\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u4e0b\u8a18\u306f\u53c2\u8003\u30b5\u30a4\u30c8\u3067\u3059\u3002<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\"><a href=\"http:\/\/lagoscript.org\/jquery\/upload\"><span style=\"color: #0000ff;\">http:\/\/lagoscript.org\/jquery\/upload<\/span><\/a><\/span><\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001jQuery\u306e\u5f8c\u306b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 30px;\">&lt;script src=&#8221;jquery\/jquery.js&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt;<br \/>\n&lt;script src=&#8221;jquery\/jquery.upload-1.0.2.js&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt;<\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3059\u308b\u3068\u3053\u308d(form)\u306f\u4e0b\u8a18\u3002\u5148\u306bjavascript\u3092\u66f8\u304d\u307e\u3057\u305f\u3002\u305d\u306e\u5f8c\u306b\u30a2\u30c3\u30d7\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3059\u308b form\u3092\u66f8\u3044\u3066\u3044\u307e\u3059\u3002input \u306b\u306f ifName \u3068\u3044\u3046 id \u304c\u4ed8\u3044\u3066\u3044\u307e\u3059\u3002ifName\u306e\u5909\u5316\u3092\u3068\u3089\u3048\u3066\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u30b9\u30bf\u30fc\u30c8\u3057\u307e\u3059\u3002demo.php \u306f\u30d5\u30a1\u30a4\u30eb\u3092\u53d7\u3051\u53d6\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002foldername\u3068\u3044\u3046\u30c6\u30ad\u30b9\u30c8\u3082\u4e00\u7dd2\u306b\u6e21\u3057\u3066\u3044\u307e\u3059\uff08\u3053\u308c\u306f\u3001\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u56fa\u6709\u306e\u8a71\u3067\u3059\uff09\u3002<\/p>\n<p style=\"padding-left: 30px;\">&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\n$(function() {<br \/>\n$(&#8216;#ifName&#8217;).change(function() {<br \/>\n$(this).upload(&#8216;.\/demo.php&#8217;,{&#8216;foldername&#8217;:sessionStorage.foldername}, function(res) {<br \/>\nalert(res);<br \/>\n}, &#8216;text&#8217;);<br \/>\n});<br \/>\n});<br \/>\n&lt;\/script&gt;<\/p>\n<p style=\"padding-left: 30px;\">&lt;input id=&#8221;ifName&#8221; type=&#8221;file&#8221; name=&#8221;file&#8221; size=&#8221;29&#8243; style=&#8221;position: absolute; left:60px; top: 634px; font-size:14px; height:24px; width:255px; &#8221; &gt;<\/p>\n<p>&nbsp;<\/p>\n<p>demo.php\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u8fd4\u4e8b\uff08\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3002\u4e2d\u8eab\u306fXML\uff09\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 30px;\">&lt;?php<\/p>\n<p style=\"padding-left: 30px;\">$filename = basename($_FILES[&#8216;file&#8217;][&#8216;name&#8217;]);<br \/>\n$foldername = $_POST[&#8216;foldername&#8217;];<\/p>\n<p style=\"padding-left: 30px;\">$tmpxml = &#8220;&#8221;;<\/p>\n<p style=\"padding-left: 30px;\">if (move_uploaded_file($_FILES[&#8216;file&#8217;][&#8216;tmp_name&#8217;], &#8220;\/var\/www\/html\/temporary\/$foldername\/&#8221; . $filename)) {<br \/>\n$tmpxml = &#8220;&lt;filename&gt;&#8221;.$filename.&#8221;&lt;\/filename&gt;\\n&#8221;;<br \/>\n} else {<br \/>\n$tmpxml = &#8220;&lt;filename&gt;Failed to save&lt;\/filename&gt;\\n&#8221;;<br \/>\n}<\/p>\n<p style=\"padding-left: 30px;\">$tmpxml = $tmpxml.&#8221;&lt;foldername&gt;&#8221;.$foldername.&#8221;&lt;\/foldername&gt;\\n&#8221;;<\/p>\n<p style=\"padding-left: 30px;\">$xml4return = &lt;&lt;&lt; end_of_quote<br \/>\n&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<br \/>\n&lt;root&gt;<\/p>\n<p style=\"padding-left: 30px;\">$tmpxml<br \/>\n&lt;\/root&gt;<br \/>\nend_of_quote;<\/p>\n<p style=\"padding-left: 30px;\">echo $xml4return;<br \/>\n?&gt;<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u3053\u308c\u3050\u3089\u3044\u3067\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(text by kondo) \u30aa\u30fc\u30b5\u30ea\u30f3\u30b0\u30c4\u30fc\u30eb\u306e\u65b9\u3067\u3059\u304c\u3001\u753b\u50cf\u306e\u30d5\u30a1\u30a4\u30eb\u3084\u3001 &#8230; <a class=\"more-link\" href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/?p=1212\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1212","post","type-post","status-publish","format-standard","hentry","category-column"],"_links":{"self":[{"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1212"}],"version-history":[{"count":1,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1212\/revisions"}],"predecessor-version":[{"id":4191,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1212\/revisions\/4191"}],"wp:attachment":[{"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1212"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}