Increase Max Upload Filesize - Version 1.3

Version Description

Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 Increase Max Upload Filesize
Version 1.3
Comparing to
See all releases

Version 1.3

Files changed (2) hide show
  1. readme.txt +63 -0
  2. upload_max_file_size.php +172 -0
readme.txt ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Increase Maximum Upload File Size ===
2
+ Contributors: WebFactory, UnderConstructionPage, googlemapswidget, securityninja, wpreset
3
+ Tags: max upload file size, increase upload limit, increase file size limit, upload limit, post max size, upload file size, upload_max_filesize
4
+ Requires at least: 3.0
5
+ Requires PHP: 5.0
6
+ Tested up to: 5.2
7
+ Stable tag: 1.3
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Increase maximum upload file size limit to any value. Increase upload limit - upload large files.
12
+
13
+
14
+ == Description==
15
+
16
+ **Increase upload file size limit to any value with one click.**
17
+
18
+ Plugin automatically detects upload limits set by WordPress and by the server / hosting provider, and displays them.
19
+
20
+ Access plugin's settings from the main WP admin menu.
21
+
22
+ If you need help, please use the <a href="https://wordpress.org/support/plugin/upload-max-file-size/">official plugin support forum</a>.
23
+
24
+
25
+ == Installation ==
26
+
27
+ The usual, automatic way;
28
+
29
+ 1. Open WordPress admin, go to Plugins, click Add New
30
+ 2. Enter "increase maximum upload" in search and hit Enter
31
+ 3. Plugin will show up as the first on the list, click "Install Now"
32
+ 4. Activate & open plugin's settings page located in the main admin menu
33
+
34
+ Or if needed, install manually;
35
+
36
+ 1. Download the plugin.
37
+ 2. Unzip it and upload to _/wp-content/plugins/_
38
+ 3. Open WordPress admin - Plugins and click "Activate" next to the plugin
39
+ 4. Activate & open plugin's settings page located in the main admin menu
40
+
41
+
42
+ == Screenshots ==
43
+
44
+ 1. Increase maximum file upload size with one click
45
+
46
+
47
+ == Frequently Asked Questions ==
48
+
49
+ = Does this plugin work with all servers and hosting providers? =
50
+
51
+ Yes, it works with all servers. But, please know that server adjusted limits can't be changed from a WordPress plugin. If the server set limit is 16MB you can't increase it to 128MB via WordPress. You have to email your hosting provider and ask them to increase the limit. Install the plugin and it'll tell you what the limits are and what to do.
52
+
53
+
54
+ == Changelog ==
55
+
56
+ = v1.3 =
57
+ * 2019/05/23
58
+ * almost complete plugin rewrite
59
+ * 50k installations, 257k downloads
60
+
61
+ = v1.0 =
62
+ * 2014/09/28
63
+ * initial release
upload_max_file_size.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Increase Maximum Upload File Size
4
+ Description: Increase maximum upload file size with one click.
5
+ Author: WebFactory Ltd
6
+ Author URI: https://www.webfactoryltd.com/
7
+ Plugin URI: https://wordpress.org/plugins/upload-max-file-size/
8
+ Version: 1.3
9
+ License: GPL2
10
+ Text Domain:upload-max-filesize
11
+
12
+ Copyright 2013 - 2019 WebFactory Ltd (email: support@webfactoryltd.com)
13
+
14
+ Increase Upload Max Filesize is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ Increase Upload Max Filesize is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with Upload Max File Size; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
+ */
27
+
28
+
29
+ // main plugin class
30
+ class WF_Upload_Max_File_Size
31
+ {
32
+
33
+ static function init()
34
+ {
35
+ // Hook for adding admin menus
36
+ add_action('admin_menu', array(__CLASS__, 'upload_max_file_size_add_pages'));
37
+ add_filter('upload_size_limit', array(__CLASS__, 'upload_max_increase_upload'));
38
+
39
+ if (isset($_POST['upload_max_file_size_field']) && wp_verify_nonce($_POST['upload_max_file_size_nonce'], 'upload_max_file_size_action')) {
40
+ $number = (int)$_POST['upload_max_file_size_field'] * 1024 * 1024;
41
+ update_option('max_file_size', $number);
42
+ wp_safe_redirect(admin_url('?page=upload_max_file_size&max-size-updated=true'));
43
+ }
44
+ } // init
45
+
46
+ /**
47
+ * Add menu pages
48
+ *
49
+ * @since 1.4
50
+ *
51
+ * @return null
52
+ *
53
+ */
54
+ static function upload_max_file_size_add_pages()
55
+ {
56
+ // Add a new menu under Settings
57
+ add_menu_page('Increase Max Upload File Size', 'Increase Maximum Upload File Size', 'manage_options', 'upload_max_file_size', array(__CLASS__, 'upload_max_file_size_dash'), 'dashicons-admin-tools');
58
+ } // upload_max_file_size_add_pages
59
+
60
+ /**
61
+ * Get closest value from array
62
+ *
63
+ * @since 1.4
64
+ *
65
+ * @param int search value
66
+ * @param array to find closest value in
67
+ *
68
+ * @return int in MB, closest value
69
+ *
70
+ */
71
+ static function get_closest($search, $arr)
72
+ {
73
+ $closest = null;
74
+ foreach ($arr as $item) {
75
+ if ($closest === null || abs($search - $closest) > abs($item - $search)) {
76
+ $closest = $item;
77
+ }
78
+ }
79
+ return $closest;
80
+ }
81
+
82
+ /**
83
+ * Dashboard Page
84
+ *
85
+ * @since 1.4
86
+ *
87
+ * @return null
88
+ *
89
+ */
90
+ static function upload_max_file_size_dash()
91
+ {
92
+ echo '<style>';
93
+ echo '.wrap, .wrap p { font-size: 15px; } .form-table th { width: 230px; }';
94
+ echo '</style>';
95
+
96
+ if (isset($_GET['max-size-updated'])) {
97
+ echo '<div class="notice-success notice is-dismissible"><p>Maximum Upload File Size Saved!</p></div>';
98
+ }
99
+
100
+ $ini_size = ini_get('upload_max_filesize');
101
+ if (!$ini_size) {
102
+ $ini_size = 'unknown';
103
+ } elseif (is_numeric($ini_size)) {
104
+ $ini_size .= ' bytes';
105
+ } else {
106
+ $ini_size .= 'B';
107
+ }
108
+
109
+ $wp_size = wp_max_upload_size();
110
+ if (!$wp_size) {
111
+ $wp_size = 'unknown';
112
+ } else {
113
+ $wp_size = round(($wp_size / 1024 / 1024));
114
+ $wp_size = $wp_size == 1024 ? '1GB' : $wp_size . 'MB';
115
+ }
116
+
117
+ $max_size = get_option('max_file_size');
118
+ if (!$max_size) {
119
+ $max_size = 64 * 1024 * 1024;
120
+ }
121
+ $max_size = $max_size / 1024 / 1024;
122
+
123
+
124
+ $upload_sizes = array(16, 32, 64, 128, 256, 512, 1024);
125
+
126
+ $current_max_size = self::get_closest($max_size, $upload_sizes);
127
+
128
+ echo '<div class="wrap">';
129
+ echo '<h1>Increase Maximum Upload File Size</h1><br><br>';
130
+
131
+ echo 'Maximum upload file size, set by your hosting provider: ' . $ini_size . '.<br>';
132
+ echo 'Maximum upload file size, set by WordPress: ' . $wp_size . '.<br>';
133
+ echo '<br><b>Important</b>: if you want to upload files larger than the limit set by your hosting provider, you have to contact your hosting provider.<br>It\'s NOT possible to increase the hosting defined limit from a plugin.';
134
+ echo '<form method="post">';
135
+ settings_fields("header_section");
136
+ echo '<table class="form-table"><tbody><tr><th scope="row"><label for="upload_max_file_size_field">Choose Maximum Upload File Size</label></th><td>';
137
+ echo '<select id="upload_max_file_size_field" name="upload_max_file_size_field">';
138
+ foreach ($upload_sizes as $size) {
139
+ echo '<option value="' . $size . '" ' . ($size == $current_max_size ? 'selected' : '') . '>' . ($size == 1024 ? '1GB' : $size . 'MB') . '</option>';
140
+ }
141
+ echo '</select>';
142
+ echo '</td></tr></tbody></table>';
143
+ echo wp_nonce_field('upload_max_file_size_action', 'upload_max_file_size_nonce');
144
+ submit_button();
145
+ echo '</form>';
146
+
147
+ echo '<p style="display: inline-block; padding: 15px; background-color: #ddd;">Did the plugin help you? Please <a href="https://wordpress.org/support/plugin/upload-max-file-size/reviews/?filter=5" target="_blank">rate it with ★★★★★</a>. It\'s what keeps it free!</p>';
148
+
149
+ echo '</div>';
150
+ } // upload_max_file_size_dash
151
+
152
+ /**
153
+ * Filter to increase max_file_size
154
+ *
155
+ * @since 1.4
156
+ *
157
+ * @return int max_size in bytes
158
+ *
159
+ */
160
+ static function upload_max_increase_upload()
161
+ {
162
+ $max_size = get_option('max_file_size');
163
+ if (!$max_size) {
164
+ $max_size = 64 * 1024 * 1024;
165
+ }
166
+
167
+ return $max_size;
168
+ } // upload_max_increase_upload
169
+
170
+ } // class WF_Upload_Max_File_Size
171
+
172
+ add_action('init', array('WF_Upload_Max_File_Size', 'init'));