1、 Modify or create php.ini
Php.ini (located in the root directory of the managed account) is a configuration file that allows you to customize PHP's behavior at run time. It contains a list of settings, including the maximum upload file size, maximum execution time, upload directory, global variables, and display errors.
For security reasons, almost all hosting service providers hide it. To access files, log in to the hosting account, navigate to the root directory, and search for php.ini. Remember to turn on the "Show hidden files" function. If there is no such file, please create a new file with the following name: "php. ini". Ensure that the file contains the above three variables.
Since we need to set the maximum file upload size to 20 MB, I will change the upload_max_filesize to 20 MB and post_max_size to 25 MB to use a 20 MB file in the body of the post. It is a good practice for post_max_size to exceed upload_max_filesize.
upload_max_filesize = 20M
post_max_size = 25M
memory_limit = 30M
Note that some hosting service providers have renamed the file php5.ini.
2、 Modify (or create). htaccess file
WordPress. htaccess is the abbreviation of Hypertext Access, which is the configuration file used by Apache server. Typically, it is located in the root directory. If the file does not exist, create it with the exact file name and extension ". htaccess".
Assuming you have the file, copy and paste the following lines of code below the file:
php_value upload_max_filesize 20MB php_value post_max_size 25MB php_value memory_limit 30MB
Note: When searching for. htaccess, do not forget to mark "Show hidden files". Your hosting service provider may hide it.
3、 Modify WordPress files
The above two methods are the most recommended methods to increase the file upload size. However, for other special reasons, when these methods do not work, you need to edit the configuration file of WordPress. Open the wp-config.php or functions.php file and paste the following lines of code:
@ini_set( ‘upload_max_size’ , ’20MB’ );
@ini_set( ‘post_max_size’, ’25MB’);@ ini_set( ‘memory_limit’, ’30MB’ );
4、 Increase the size of WordPress uploaded files through plug-ins
The advantage of WordPress is that it has many excellent plug-ins. If you do not want to increase the file upload size manually, you can use the name "Increase Maximum Upload File Size", and just enter a value in bytes (1024000 bytes=1 MB). For 20 MB, multiply 1024000 by 20 and enter 20480000 in the text box. Click Save Changes.
The plug-in can automatically detect the file upload size and increase the file upload size. Just activate the plug-in, go to "Increase Maximum Upload File Size" on the sidebar, and set the maximum file upload size.
When uploading larger files, it is convenient to upload them via FTP.