🚀 Is building a website too difficult? Let me guide you step by step—Learn about the 「Naibabiji WordPress Website Building Coaching Service」 →

5 Correct Methods to Increase Upload Attachment Size in WordPress

Hello everyone, I am Brother Lei Feng. Recently, Brother Lei Feng helped someone build a website that required uploading large video files. The upload limit for WordPress media files is typically within 50M, which is related to your installed environment configuration.

After searching online for tutorials, many were incorrect. Some even suggested adding @ini_set( 'upload_max_size' , '64M' ); in functions.php, which is actually ineffective. The most correct method is to modify the php.ini file along with the configuration files for nginx/Apache. Below, I'll explain how to make these modifications.

# Connect to the VPS server using SSH software # Reference tutorial:#建站#Xshell 6 Basic Tutorial: Connecting to a VPSIf you are not comfortable modifying files directly via SSH, you can also usexftpor similar software to download the file to your local machine, modify it, and then upload it to the server to overwrite the original.

Modify upload file size in php.ini

Step 1:Enter php -i | grep 'php.ini'Step 2:Copy the obtained php.ini pathStep 3:Enter sudo gedit /usr/local/php/etc/php.ini (or use your preferred editor, such as vim)Step 4:Search for upload_max_filesize and change the following value to = 5000M (here, I changed it to 5G)Step 5:Search for post_max_size and change the following value to = 5000M (here, I changed it to 5G)Step 6:Save

Modify upload file size in nginx

Step 1:Enter sudo gedit /usr/local/nginx/conf/vhost/www.yourdomain.com.conf (or use your preferred editor, such as vim) Note: Your website's configuration file may not be in the above location; please modify the command path according to your actual situation.Step 2: In the opened .conf file, add the following content, then save it.
location ~ .php$ {
client_max_body_size 5000M;
}
Step 3: Reload the nginx configuration or restart nginx to make it effective.

Modify upload file size in apache

Open the .htaccess file in the website's root directory and add the following content:
php_value upload_max_filesize 5000M
php_value post_max_size 5000M
Then save it, and you will have successfully increased the attachment upload size.

Increase/Modify WP attachment upload size in Baota Panel

# Baota Panel Installation Tutorial:Beginner-Friendly Baota Panel Illustrated Installation Tutorial for Building Your Own Website Step 1:Software Store → Installed → php → Settings → Configuration Modification, change Post_max_size and upload_max_filesize to your desired upload capacity size. Step 2:Taking nginx as an example, open Software Store → Installed → nginx → Settings → Performance Tuning, find Client_max_body_size and change it to your desired upload capacity size.Finally, you need to restart PHP and nginx/Apache for the changes to take effect.

Multisite WordPress Settings

If you areWordPress MultisiteAfter the above settings, you also need to log in as a super admin → Settings → Network Settings, find „Upload Settings,“ and set the attachment size separately there.That's the correct method to increase the upload attachment size in WordPress. If not necessary, it's better not to set the upload attachment size too large to avoid affecting performance due to uploading overly large attachments. For temporary upload needs, you can use FTP.

🚀 Still feeling confused after reading the tutorial? Let me guide you step-by-step.

「Naibabiji WordPress Website Building Coaching Service」—From choosing a domain and buying hosting, to installing a Theme and publishing content, I「ll coach you through every step, helping you avoid detours and reach your goal directly.

👉 Learn about the Website Building Coaching Service
🔒

Comments are closed

The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.

×
二维码

Scan QR Code to Follow

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: