How to increase the limits on the size of uploaded files and the amount of memory allocated for PHP. We increase the size of a JPEG file using different methods Changing limits in WHM

By default, WordPress has a limit on the size of uploaded files, which depends on the server settings.

This limitation exists to ensure the security and performance of the site. It prevents users from overloading your site by downloading large files and crashing the server.

If you have a large site with heavy content, you may need to increase the maximum file upload size.

You might receive an error like this:

The uploaded file exceeds the upload_max_filesize directive in php.ini

In this article, you will learn how to increase the maximum file upload size in WordPress in three ways:

How to find out the maximum file size for uploading in WordPress

The media downloader uses PHP to download files and has server restrictions on the maximum size of downloaded files. WordPress automatically shows this size in the Media Gallery:

WordPress - Media - Library

WordPress - Media - Add New

Increasing the maximum file upload size in functions.php

In some cases this method may work, in others it may not. Try adding this code to the file active topic:

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

Increasing the maximum size of uploaded files in php.ini

Using a file manager on your hosting or an FTP client, go to the root folder of your site and find the file php.ini. This file does not exist in the standard WordPress installation; if you don’t have it, create it and add the following entry to it:

upload_max_filesize = 100M
post_max_size = 200M
memory_limit = 256M
file_uploads = On
max_execution_time = 300

upload_max_filesize = 100M— The maximum upload file size is 100 MB.
post_max_size = 200M— Maximum post size.
memory_limit = 256M- which WordPress can use to work with plugins and scripts. If you've edited this setting before, keep it in just one place.

Change 100M, 200M And 256M to the values ​​you need. Make parameters 1 - 3 increase from smallest to largest, that is, the value upload_max_filesize should be less than others post_max_size- average, and memory_limit- the biggest.

Meaning max_execution_time = 300 means the amount of time in seconds that can be spent loading one script.

Clear cache, check changes.

If this method doesn't work, try renaming the file php.ini V php5.ini.

Increasing the maximum size of uploaded files in .htaccess

If it was not possible to change restrictions through the file php.ini, try editing the file .htaccess.

This file is located in the site's root folder, but may not be visible. Check your file manager or FTP client settings. Add these lines at the very end .htaccess:

php_value upload_max_filesize 100M
php_value post_max_size 200M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 180

You can edit this file in the same way as the file php.ini.

Change the limits to values ​​that suit you.
Save changes, upload to server, update cache.

Hosting panel

If you were unable to increase the limit on the size of uploaded files using any of these methods, try going to your hosting and finding the necessary settings. There may be a section in your hosting control panel where you can change these settings.

If none of these methods help, contact technical support for help, this is a simple question, they can help increase the maximum size of downloaded files.

If you need to upload a large file or files only once, for security reasons you can upload them via FTP without changing the maximum size limit.

Typically files uploaded via FTP to a folder /wp-content/uploads/ are not displayed in the media library in the WP admin, but you can install the Media from FTP plugin, which will show files uploaded via FTP in the WP library. This plugin is updated regularly and supports regular and multisite WordPress installations.

The information placed in the file is presented in a compressed form. This is done to save space and to make it easier to send images over the Internet. However, there are times when such compression interferes. For example, when processing documents for a foreign passport, a fairly large photo file size is required. There is a problem with increasing file size.

To increase the size of a JPEG file, you can either use a third-party program (Photoshop) or resave it to another format (does not always solve the problem).

Quick navigation through the article

Resaving to another format

The easiest way to increase the size of a JPEG file is to save it in a format that does not use compression (for example, the bmp format). To do this, open the file in any graphic editor and save it in a different format. The Tiff file size will also be much larger than the original JPEG file size.

However, changing the file extension is not always appropriate. You can increase the JPEG size by changing the format twice. For example, change the original JPEG format to bmp, and then change bmp to JPEG. However, if you change the format again, set the quality to high to increase the resulting file size.

The information in a JPEG file is in a compressed state and sometimes the file size becomes too small. If you need to increase the original size of this JPEG file, then contact graphic editors.

Using Photoshop

  • Using Photoshop, you can resize a picture by making it larger, thereby increasing the file size.
  • Open the file in Photoshop and use the Image size function.
  • In the window you can increase the size of the drawing or photo. Don't forget to set "Maintain proportions" to completely preserve the original appearance of the picture. Please note that you should not enlarge the photo too much, as this will reduce the quality.
  • Save the enlarged drawing in the same JPEG format, but at the highest quality. You will be immediately shown the file size.

This way you can achieve the desired magnification.

Increase or decrease Limits on the allowed size of files for uploading in WordPress can be very fast and easy. To do this, I recommend the simplest and most reliable method.

Open the file functions.php in your theme folder. Path to this file: www\wp-content\themes\your_theme_name\functions.php. We go to FTP, copy the functions.php file to the computer and open it using a text editor (I recommend Notepad++).

You can also open a file with functions through the admin panel of your site. To do this, go to Appearance -> Editor and in the list on the right select for editing Theme features.

The following command should be inserted at the end of the functions.php file, before the closing ?> tag.

WordPress Upload File Size Limit:

add_filter("upload_size_limit", "PBP_increase_upload"); function PBP_increase_upload($bytes) ( return 1048576; // 1 megabyte )

By changing a numeric value in code, you can easily increase or decrease restrictions on the size of files allowed for uploading to a WordPress site.

After you have pasted the code above, do not forget to save the file and upload it back to your site via FTP (if you added the code through the site admin, click the button "Update file").

Of course, there are other ways to change the size of files for uploading, for example, changing the values ​​in the php.ini configuration file or through .htaccess... But in my opinion, the example I gave above is the most practical and understandable.

If something didn’t work out or you still have questions, ask them in the comments.

Increasing or decreasing the file upload size limits in WordPress is quick and easy. To do this, I recommend the simplest and most reliable method. Open the functions.php file in your theme folder. Path to this file: www\wp-content\themes\your_theme_name\functions.php. We go to FTP, copy the functions.php file to the computer and open it using a text editor (I recommend Notepad++). You can also open a file with functions through the admin panel of your site. To do this, go to Appearance -> Editor and in the list on the right select Theme Functions for editing. The following command should be inserted at the end of the functions.php file, before the closing ?> tag. WordPress upload size limit: add_filter("upload_size_limit", "PBP_increase_upload"); function PBP_increase_upload($bytes) ( return…

Don't have enough random access memory (RAM) to surf the Internet or run a modern game? Before increasing its size, try setting up the swap file. It is quite possible that your PC or laptop will work much faster. Read below to learn what it is and how to enable the page file in Windows 7, 8 or 10.

What is a page file?

First, a little theory. The paging file is a special file that Windows accesses if the PC does not have enough current RAM to operate. Simply put, this is virtual memory that is added to the current one, as a result of which the speed of the laptop or computer improves.

Let me give you a simple example. You want to run a game that requires 4GB of RAM. And you only have 3 GB. What to do in this case? Increase virtual memory and Windows will “take” the missing 1 GB from this special file. This way you can launch the game and play it.

Of course, there are several points here:

  1. Increasing virtual memory can slow down your computer. After all, the speed of access to RAM is much faster than to a hard drive (namely, the paging file is stored on it).
  2. Using this function creates an extra load on the HDD drive and reduces its operating time.

How to increase virtual memory in Windows 7

For this:

  1. Go to Start - Control Panel - System.
  2. Click on "Add." options".
  3. Find the Performance section and click on Settings.
  4. In the new window, select the “Advanced” tab.

This is where virtual memory is configured. As a rule, the currently used size is already indicated here (in the screenshot below it is 8173 MB, i.e. 8 GB). To increase virtual memory in Windows 7, click on the "Change" button.

The same window will appear where you can configure the paging file.

If your PC or laptop slows down, it means there is not enough RAM and it needs to be increased. To begin, uncheck this box. All buttons will become active and you can enable the page file in Windows 7 and configure it as you wish. To do this, check the box next to the “Specify size” line and write down the original and max. volume. For example – 4096 MB (that’s 4 GB).

Important: to avoid brakes and glitches, the initial and max. the size must be the same. For example, 4096 MB (as in the screenshot above).

By the way, what is the optimal size of the paging file? There is a lot of advice on this issue on the Internet, and the calculation formulas are also intricate.

The best option would be to increase your computer's virtual memory by 50% of your RAM. That is, the swap file for 4 GB will be 2048 MB. And for 8 GB of RAM you can specify 4096 MB. As a result, the total memory will be 6 and 12 GB, respectively - this should be enough for all occasions.

If your PC has a lot of RAM installed (for example, 8 GB), and you only work on the Internet, then you can completely disable the page file. After all, as I said above, it loads the hard drive, which sometimes slows down the PC.

However, this is not recommended. Perhaps after a while you want to start a game or video processing, and an error will pop up that there is not enough memory. And you will most likely forget about virtual memory. As a result, you will waste a lot of nerves before you fix this problem.

In general, if you need to increase virtual memory in Windows 7, specify it manually. And if you need to restore the previous values, check the very first box and close this window.