How to Increase WordPress Maximum Upload File Size: The Complete Guide

WordPress It is a powerful website builder with rich themes and plugins that can meet a wide range of website needs, such as e-commerce websites, official corporate websites, personal portfolio websites, etc. However, when uploading larger media files, it encounters the problem of default upload size limitation, especially when uploading large images, videos or plugins.

This post will go over WordPress' default upload file size limit, how to check the current upload size, and the best way to raise the limit.

图片[1]-如何增加 WordPress 的最大上传文件大小限制:详细方法指南

What is the WordPress maximum upload file size limit?

In a WordPress website, there is a need to upload multiple media files such as images, videos, themes and plugins. If the default upload file size limit is too low, it may become a hindrance to uploading large files. Typically, WordPress has a maximum upload file size limit of 2MB to 150MB between, depending on your server configuration. Most hosts set this limit at the server level in order to prevent timeouts. The limit varies from one cloud provider to another.

How to check the current maximum upload file size?

To check the current maximum upload file size for WordPress, you can follow these steps:

1. Log in to your WordPress dashboard.

2. Navigating to Media → Add New MediaThe

3. The current maximum upload file size limit can be seen at the bottom of the page.

图片[2]-如何增加 WordPress 的最大上传文件大小限制:详细方法指南

    If the current limit meets the requirements, you can keep the default settings. However, if the limit is too low, you can increase the upload file size limit.

    How to increase the maximum upload size of media files in WordPress?

    Update the .htaccess file

    If your web server uses Apache and PHP is set up as an Apache module, you can increase the maximum upload size in WordPress by adding a few lines of code to the WordPress .htaccess file.

    To access your .htaccess file, connect to your server via an FTP client and navigate to the folder where WordPress is installed. To connect to your server via an FTP client such as FileZilla, you will need the following values:

    • Host
    • Username
    • Password
    • Port
    图片[3]-如何增加 WordPress 的最大上传文件大小限制:详细方法指南

    Open it in a code editor or notepad .htaccess fileand add the following line of code.

    php_value upload_max_filesize 64M
    php_value post_max_size 128M
    php_value memory_limit 256M
    php_value max_execution_time 300
    php_value max_input_time 300

    This will define the maximum upload size in megabytes. Replace the numbers as required. Maximum execution time and maximum input time in seconds. The execution time defines the time limit spent by a single script. Select the number that is appropriate for the site.

    Edit the functions.php file

    Sometimes, it may not be possible to access the .htaccess file or it may be more difficult to edit the WordPress theme files.

    This can be accomplished by adding the theme's functions.php fileAdd the following line of code to easily increase the size limit. To access the functions.php file, go to the WordPress Dashboard → Appearance → Theme File Editor, and then select the theme function file.

    图片[4]-如何增加 WordPress 的最大上传文件大小限制:详细方法指南

    However, if the theme is changed, the maximum upload size will return to its default value until the functions.php file of the new theme is edited, as the following code is only added to the current theme.

    @ini_set( 'upload_max_size' , '64M' );
    @ini_set( 'post_max_size', '64M' );
    @ini_set( 'max_execution_time', '300' );

    After saving the changes, check if the upload size has been updated.

    Attention:This method only works with the current theme. If you change the theme, you need to modify the new theme file again.

    Creating or editing php.ini files

    This is the default file used to configure any application running on PHP. This file contains the parameters needed for file timeouts, upload sizes and resource limits. Use SSH or FTP to access the WordPress root directory and look for the php.ini file. In some cases, this file is not visible; the alternative is to create a new file.

    Open any text editor and create a new file on your desktop. Copy the following code and save it as php.ini.

    upload_max_filesize = 64M
    post_max_size = 128M
    memory_limit = 264M
    图片[5]-如何增加 WordPress 的最大上传文件大小限制:详细方法指南

    If you create a new PHP.ini file, add a new PHP.ini file to theOne folder.You can upload it using SSH or FTP from within.

    Increase upload size for multiple sites

    If you run theWordPress MultisiteFor example, you can increase the upload size from the settings. This increase depends on the server settings. If the server is set to 20MB, it is not possible to increase the WordPress upload size to 25MB. however, if the server is set to 20MB and the network is set to 15MB, the problem can be solved by increasing the upload size to 20MB.

    图片[6]-如何增加 WordPress 的最大上传文件大小限制:详细方法指南

    Change the wp-config.php file.

    Another way to increase the size of your WordPress uploads is to define the size parameter in the wp-config.php file. So, use SSH or FTP to access the WordPress root directory and find the wp-config.php fileThe

    wp-config.php

    Open the file in any text editor and add the following code.

    @ini_set( 'upload_max_size' , '20M' );
    @ini_set( 'post_max_size', '13M' );
    @ini_set( 'memory_limit', '15M' );

    Save changes.

    How to use the plug-in

    In addition to writing code or accessing the root file using SSH or FTP. Plugins can also be used, and there is a WordPress plugin available for increasing the WordPress upload size. The plugin is " Increase Max Upload Filesize"The

    图片[8]-如何增加 WordPress 的最大上传文件大小限制:详细方法指南

    Go to WordPress Dashboard → Plugins → Add New PluginIf you have any questions, search for "Increase Max Upload Filesize", then install and activate the plugin. Once installed, go to Plugin Settings and enter a value for the upload size.

    图片[9]-如何增加 WordPress 的最大上传文件大小限制:详细方法指南

    Click "Save Changes" button to apply the new upload size.

    summarize

    Boosting the WordPress maximum upload file size limit is not complicated, and the above methods are applicable in almost all cases. Whether it's modifying files, using a plugin, you can find the solution that works best for you.


    Contact Us
    Can't read the article? Contact us for free answers! Free help for personal, small business sites!
    Tel: 020-2206-9892
    QQ咨询:1025174874
    (iii) E-mail: info@361sale.com
    Working hours: Monday to Friday, 9:30-18:30, holidays off
    © Reprint statement
    This article was written by Banner1
    THE END
    If you like it, support it.
    kudos40 share (joys, benefits, privileges etc) with others
    commentaries sofa-buying

    Please log in to post a comment

      No comments