{"generator":"Code Snippets v3.5.0","date_created":"2023-10-17 23:41","snippets":[{"id":10,"name":"_______upload max filesize (\uad00\ub9ac\uc790 \uc678 \uc218\uc815\uae08\uc9c0)","desc":"

\uc0ac\uc6a9\ubc29\ubc95 (\uc544\ub798 \ub9c1\ud06c \ud074\ub9ad)<\/strong><\/a><\/p>\n

https:\/\/snippets.stofarm.com\/upload_maxfilesize<\/strong><\/a><\/p>","code":"\/\/ \uc774 \ucf54\ub4dc\ub294 \uc218\uc815 \uc911 \uc5d0\ub7ec\uac00 \ubc1c\uc0dd\ud560 \uacbd\uc6b0 \uc18c\uc2a4 \ubcf5\uad6c \ube44\uc6a9 10\ub9cc\uc6d0\uc774 \ucd94\uac00\ub418\ubbc0\ub85c \uc808\ub300 \uc218\uc815\ud558\uc9c0 \ub9c8\uc2dc\uae30 \ubc14\ub78d\ub2c8\ub2e4!!\n\/\/ \uc544\ub798 \ub9c1\ud06c\ub97c \ud1b5\ud574 \uc0ac\uc6a9\ubc29\ubc95\uc744 \uaf2d \ud655\uc778\ud558\uace0 \uc0ac\uc6a9\ud558\uc138\uc694!! - \ud504\ub85c\uadf8\ub798\uba38 \ubb38\ud638\uc601\n\/\/ https:\/\/snippets.stofarm.com\/upload_maxfilesize\n\n\/\/ \uc6a9\ub7c9\uacfc \uc2dc\uac04 \uc124\uc815\n$max_upload_size = '1G';\n$max_post_size = '1G';\n$max_execution_time = '1200';\n$max_input_time = '1200';\n\n\/\/ \uad00\ub9ac\uc790 \ub300\uc2dc\ubcf4\ub4dc\uc5d0\uc11c\ub9cc .htaccess \uc5c5\ub370\uc774\ud2b8\nif (is_admin()) {\n\tfunction update_htaccess_for_upload_settings($max_upload_size, $max_post_size, $max_execution_time, $max_input_time) {\n\t\t$htaccessPath = $_SERVER['DOCUMENT_ROOT'] . '\/.htaccess';\n\n\t\tif (file_exists($htaccessPath)) {\n\t\t\t$original_content = file_get_contents($htaccessPath);\n\n\t\t\t\/\/ \uc5ec\uae30\uc5d0 $patterns_to_delete \ubcc0\uc218\ub97c \uc120\uc5b8\ud569\ub2c8\ub2e4.\n\t\t\t$patterns_to_delete = [\n\t\t\t\t'\/php_value\\s+upload_max_filesize\\s+\\S+\/',\n\t\t\t\t'\/php_value\\s+post_max_size\\s+\\S+\/',\n\t\t\t\t'\/php_value\\s+max_execution_time\\s+\\d+\/',\n\t\t\t\t'\/php_value\\s+max_input_time\\s+\\d+\/'\n\t\t\t];\n\n\t\t\t\/\/ \uae30\uc874 \ub0b4\uc6a9\uc5d0 \uc6b0\ub9ac\uc758 \uc124\uc815\uac12\uc774 \uc788\uc73c\uba74 \uadf8\uac83\ub9cc \uc81c\uac70\n\t\t\tforeach ($patterns_to_delete as $pattern) {\n\t\t\t\t$original_content = preg_replace($pattern, \"\", $original_content);\n\t\t\t}\n\n\t\t\t\/\/ \uae30\uc874 \ub0b4\uc6a9\uacfc \uc0c8\ub85c\uc6b4 \uc124\uc815\uac12\uc744 \ud569\uccd0\uc11c .htaccess \ud30c\uc77c\uc5d0 \uc4f4\ub2e4.\n\t\t\t$updated_content = trim($original_content);\n\t\t\t$updated_content .= \"\\nphp_value upload_max_filesize \" . $max_upload_size;\n\t\t\t$updated_content .= \"\\nphp_value post_max_size \" . $max_post_size;\n\t\t\t$updated_content .= \"\\nphp_value max_execution_time \" . $max_execution_time;\n\t\t\t$updated_content .= \"\\nphp_value max_input_time \" . $max_input_time;\n\n\t\t\tfile_put_contents($htaccessPath, $updated_content);\n\t\t}\n\t}\n\n\n\n\tadd_action('admin_init', function() use ($max_upload_size, $max_post_size, $max_execution_time, $max_input_time) {\n\t\tupdate_htaccess_for_upload_settings($max_upload_size, $max_post_size, $max_execution_time, $max_input_time);\n\t});\n\n}\n\nfunction display_upload_settings($max_upload_size, $max_post_size, $max_execution_time, $max_input_time) {\n if ($_SERVER['REQUEST_URI'] == '\/check-upload') {\n echo '\n \n \n \n \n \ud30c\uc77c \uc5c5\ub85c\ub4dc \uc124\uc815 \uc0c1\ud0dc<\/title>\n <style>\n body { font-family: Arial, sans-serif; background-color: #f4f4f4; height: 100vh; display: flex; align-items: center; justify-content: center; }\n .container { background-color: #fff; padding: 40px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); width: 80%; max-width: 600px; text-align: center; }\n h1 { font-size: 24px; margin-bottom: 20px; }\n p { font-size: 18px; margin-bottom: 10px; }\n .info-button { display: inline-block; background-color: #007BFF; color: #FFFFFF; padding: 10px 20px; border-radius: 5px; text-decoration: none; font-weight: bold; margin-top: 20px; }\n <\/style>\n <\/head>\n <body>\n <div class=\"container\">\n <h1>\ud30c\uc77c \uc5c5\ub85c\ub4dc \uc124\uc815 \uc0c1\ud0dc<\/h1>\n <p><strong>upload_max_filesize:<\/strong> ' . $max_upload_size . '<\/p>\n <p><strong>post_max_size:<\/strong> ' . $max_post_size . '<\/p>\n <p><strong>max_execution_time:<\/strong> ' . $max_execution_time . '<\/p>\n <p><strong>max_input_time:<\/strong> ' . $max_input_time . '<\/p>\n <a href=\"https:\/\/snippets.stofarm.com\/upload_maxfilesize\" target=\"_blank\" class=\"info-button\">FileMaxSize \uc0ac\uc6a9\uc124\uba85 \ubc14\ub85c \ud655\uc778<\/a>\n <\/div>\n <\/body>\n <\/html>';\n exit;\n }\n}\n\nadd_action('template_redirect', function() use ($max_upload_size, $max_post_size, $max_execution_time, $max_input_time) {\n\tdisplay_upload_settings($max_upload_size, $max_post_size, $max_execution_time, $max_input_time);\n});\n","tags":["add_action"],"active":true,"modified":"2023-10-17 23:40:47","revision":"57"}]}