{"id":26933,"date":"2021-04-30T09:21:00","date_gmt":"2021-04-30T06:21:00","guid":{"rendered":"https:\/\/themewp.inform.click\/?p=26933"},"modified":"2025-02-12T05:48:40","modified_gmt":"2025-02-12T02:48:40","slug":"peremistit-zip-fajl-iz-servera-na-server-za-dopomogoju-ajax","status":"publish","type":"post","link":"https:\/\/themewp.inform.click\/uk\/peremistit-zip-fajl-iz-servera-na-server-za-dopomogoju-ajax\/","title":{"rendered":"\u041f\u0435\u0440\u0435\u043c\u0456\u0441\u0442\u0456\u0442\u044c Zip-\u0444\u0430\u0439\u043b \u0456\u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e Ajax"},"content":{"rendered":"<p>\u041e\u043f\u0443\u0431\u043b\u0456\u043a\u043e\u0432\u0430\u043d\u043e \u0432 PHP<\/p>\n<p>\u0426\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0434\u043e\u043f\u0438\u0441 \u043d\u0430 \u0442\u0435\u043c\u0443 <strong>\u043f\u0435\u0440\u0435\u043c\u0456\u0449\u0435\u043d\u043d\u044f zip-\u0444\u0430\u0439\u043b\u0443 \u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e Ajax<\/strong>. \u041d\u0435\u0449\u043e\u0434\u0430\u0432\u043d\u043e \u044f \u043f\u0440\u0430\u0446\u044e\u0432\u0430\u0432 \u043d\u0430\u0434 \u043f\u043e\u0434\u0456\u0431\u043d\u0438\u043c \u0437\u0430\u0432\u0434\u0430\u043d\u043d\u044f\u043c \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0437 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0456\u0432 \u043c\u043e\u0433\u043e \u043a\u043b\u0456\u0454\u043d\u0442\u0430. \u0426\u0435 \u043c\u043e\u0436\u0435 \u0431\u0443\u0442\u0438 \u043a\u043e\u0440\u0438\u0441\u043d\u043e \u0434\u043b\u044f \u043a\u043e\u0433\u043e\u0441\u044c, \u0442\u043e\u043c\u0443 \u044f \u0432\u0438\u0440\u0456\u0448\u0438\u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u0438 \u043d\u0430 \u043d\u044c\u043e\u043c\u0443 \u0434\u043e\u043f\u0438\u0441.<\/p>\n<p>\u0423 \u0446\u0456\u0439 \u0441\u0442\u0430\u0442\u0442\u0456 \u044f \u043f\u0440\u0438\u043f\u0443\u0441\u043a\u0430\u044e, \u0449\u043e \u0443 \u0432\u0430\u0441 \u0454 \u043a\u043d\u043e\u043f\u043a\u0430 \u043d\u0430\u0434\u0441\u0438\u043b\u0430\u043d\u043d\u044f, \u0456 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 zip-\u0444\u0430\u0439\u043b \u0437 \u0456\u043d\u0448\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0421\u043a\u0430\u0436\u0456\u043c\u043e, \u0448\u043b\u044f\u0445 \u0434\u043e ZIP-\u0444\u0430\u0439\u043b\u0443 &#8211; <a href=\"http:\/\/example.com\/archieves\/test.zip\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">http:\/\/example.com\/archieves\/test.zip<\/a>.<\/p>\n<p>\u041f\u043e\u043c\u0456\u0441\u0442\u0456\u0442\u044c \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043d\u0438\u0436\u0447\u0435 \u043a\u043e\u0434 \u0443 \u0441\u0432\u0456\u0439 \u0444\u0430\u0439\u043b. \u0423 \u0446\u044c\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0456 \u043c\u0438 \u0432\u0438\u043a\u043b\u0438\u043a\u0430\u0454\u043c\u043e Ajax \u0437\u0430 \u043d\u0430\u0442\u0438\u0441\u043a\u0430\u043d\u043d\u044f\u043c \u043a\u043d\u043e\u043f\u043a\u0438. \u0414\u043e \u0444\u0430\u0439\u043b\u0443 Ajax \u043c\u0438 \u043d\u0430\u0434\u0441\u0438\u043b\u0430\u0454\u043c\u043e \u0432\u0438\u0445\u0456\u0434\u043d\u0438\u0439 \u0448\u043b\u044f\u0445 \u0434\u043e \u0444\u0430\u0439\u043b\u0443 zip.<\/p>\n<pre><code>&lt;input type=\"button\" class=\"submit\" value=\"Submit\"&gt;\n\u00a0\n&lt;script src=\"https:\/\/code.jquery.com\/jquery-1.10.2.js\"&gt;&lt;\/script&gt;\n&lt;script type=\"text\/javascript\"&gt;\n\u00a0\u00a0\u00a0\u00a0$(function() {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$('body').on('click', '.submit', function() {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$.ajax({\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0type: 'POST',\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0url: 'ajax.php',\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0data: {'source': 'http:\/\/example.com\/archieves\/test.zip'},\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0success:function(response) {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0alert(response);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0});\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0});\n\u00a0\u00a0\u00a0\u00a0});\n&lt;\/script&gt;<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0456, \u0443 \u0444\u0430\u0439\u043b\u0456 ajax.php \u043c\u0438 \u043f\u0438\u0448\u0435\u043c\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u043d\u0438\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0456\u0449\u0435\u043d\u043d\u044f zip-\u0444\u0430\u0439\u043b\u0443 \u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440. \u041d\u0438\u0436\u0447\u0435 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u043e \u043a\u043e\u0434 \u0443 \u0444\u0430\u0439\u043b\u0456 ajax.php.<\/p>\n<pre><code>&lt;?php\n$arr_file = explode(\"\/\", $_POST['source']);\n$filename = end($arr_file);\n\u00a0\nfile_put_contents($filename, file_get_contents($_POST['source']));\n\u00a0\necho 'success';\n?&gt;<\/code><\/pre>\n<p>\u0426\u0435 \u0432\u043e\u043d\u043e. \u0421\u043f\u043e\u0434\u0456\u0432\u0430\u044e\u0441\u044f, \u0432\u0438 \u0440\u043e\u0437\u0443\u043c\u0456\u0454\u0442\u0435, \u044f\u043a \u043f\u0435\u0440\u0435\u043c\u0456\u0449\u0443\u0432\u0430\u0442\u0438 zip-\u0444\u0430\u0439\u043b \u0456\u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e Ajax. \u042f\u043a\u0449\u043e \u0443 \u0432\u0430\u0441 \u0454 \u044f\u043a\u0456\u0441\u044c \u0437\u0430\u043f\u0438\u0442\u0430\u043d\u043d\u044f \u0447\u0438 \u043f\u0440\u043e\u043f\u043e\u0437\u0438\u0446\u0456\u0457, \u0437\u0430\u043b\u0438\u0448\u0442\u0435 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440 \u043d\u0438\u0436\u0447\u0435. \u0411\u0443\u0434\u044c \u043b\u0430\u0441\u043a\u0430, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0441\u0442\u0430\u0442\u0442\u0456, \u043f\u043e\u0432&#8217;\u044f\u0437\u0430\u043d\u0456 \u0456\u0437 \u0446\u0438\u043c, <a href=\"https:\/\/themewp.inform.click\/uk\/zavantazhennja-fajliv-ajax-za-dopomogoju-php-ta-jquery\/\" title=\"\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0444\u0430\u0439\u043b\u0456\u0432 Ajax \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e PHP \u0442\u0430 jQuery\">\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0444\u0430\u0439\u043b\u0456\u0432 Ajax \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e PHP \u0442\u0430 jQuery<\/a> \u0442\u0430 <a href=\"https:\/\/themewp.inform.click\/uk\/peretiahnit-zavantazhennia-fajliv-za-dopomohoiu-javascript-ta-php\/\" title=\"\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f\">\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f<\/a> \u0442\u0430 <a href=\"https:\/\/themewp.inform.click\/uk\/peretiahnit-zavantazhennia-fajliv-za-dopomohoiu-javascript-ta-php\/\" title=\"\u043f\u0435\u0440\u0435\u0442\u044f\u0433\u0443\u0432\u0430\u043d\u043d\u044f \u0444\u0430\u0439\u043b\u0456\u0432 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e JavaScript \u0442\u0430 PHP\">\u043f\u0435\u0440\u0435\u0442\u044f\u0433\u0443\u0432\u0430\u043d\u043d\u044f \u0444\u0430\u0439\u043b\u0456\u0432 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e JavaScript \u0442\u0430 PHP<\/a>.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0414\u0436\u0435\u0440\u0435\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0443: artisansweb.net<\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0423 \u0446\u0456\u0439 \u0441\u0442\u0430\u0442\u0442\u0456 \u043c\u0438 \u0432\u0438\u0432\u0447\u0430\u0454\u043c\u043e, \u044f\u043a \u043f\u0435\u0440\u0435\u043c\u0456\u0449\u0443\u0432\u0430\u0442\u0438 zip-\u0444\u0430\u0439\u043b \u0456\u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e Ajax. \u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u043c\u0438 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u043c\u043e PHP-\u043c\u0435\u0442\u043e\u0434 file_put_contents () \u0442\u0430 file_get_contents ().<\/p>\n","protected":false},"author":1,"featured_media":21967,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[153],"tags":[851],"class_list":["post-26933","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-153","tag-affiai-uk"],"_links":{"self":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts\/26933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/comments?post=26933"}],"version-history":[{"count":1,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts\/26933\/revisions"}],"predecessor-version":[{"id":513195,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts\/26933\/revisions\/513195"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/media\/21967"}],"wp:attachment":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/media?parent=26933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/categories?post=26933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/tags?post=26933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}