How to Modify the Max Upload File Size or Image Uploads in Drupal 7?

As one of the best open-source CMSs, Drupal offers you a wide array of settings to customize and optimize your blog site. One of those settings is to modify the max upload file or image size. Setting the maximum or minimum size means that anyone who uploads files and images should obey the specified width and height values.

Here is a tutorial on how to modify the maximum size for uploading files and images in Drupal 7. For Drupal users who are plagued by the PHP maximum upload size limit, we’ll also demonstrate how you can increase the default limit on file attachment on a Drupal 7 site. Now, let’s go further and deep into the details.

How to Set the Maximum Upload Sizes for Image and File?

On the whole, this modification process is quite easy-to-follow and requires no above-average technical knowledge. If you wish, it’s possible to adjust the maximum sizes for uploaded files/images to your exact specification from the admin dashboard. Following are the simple steps you may take for that purpose.

Step 1 – Choose & Manage Content Types
First off, you should log onto the Drupal backend with your admin username and password. Upon entering, just hover over to the “Structure” option across the top of the left-hand menu bar. This will open a new setting window where you are displayed with a couple of editing options, such as “Blocks”, “Menus” and “Taxonomy.” To proceed, you only need to locate and hit on this “Content Types” from the following screencast.

Choose & Manage Content Types

Step 2 – Edit Basic Pages
The next step is to move your mouse to the “Basic Pages” section and make a click on its “Edit” button from the “Operations” area. If done correctly, there will be a new page where you are prompted to enter the “Manage Fields” tab. By the way, you can choose to add a new content type, which is beyond the scope of this guide.

Edit Basic Pages

Step 3 – Set Maximum & Minimum Image Resolutions
From the next screenshot, you should navigate to the “Image” row and click the “Edit” link within the same “Operations” column. This will open a new settings page, from which you can take a look through the “Basic Settings” on uploaded images. Just drop down and find out this “Maximum image resolution” section.

Set Maximum & Minimum Image Resolutions

As you may notice, the default maximum sizes for images are blank, which indicates that Drupal supports unlimited size. Assuming that you’d like to set desired maximum range for uploaded images, you’ll have to input both the width and height in pixels.

In this way, any overlarge images will be scaled down to fit the specified width and height. Note that, resizing upload images would affect the inbuilt EXIF data. To set the minimum image resolution, you can repeat the steps, and any images that are smaller than this range will be automatically rejected.

Step 4 – Specify Max Upload File Size
As is showed below, you are allowed to modify the upload file size by filling in preferred values. If you’re going to restrict the file size in kilobytes, just enter the number that is followed by a space and “KB”. To set the number in megabytes, you can simply insert “30 MB” as follows. Do remember to click the bottom “Save Changes” button to save the max size and file settings.

Specify Max Upload File Size

How to Increase Max Upload Size in the php.ini?

The marked “2MB” notation reflects the maximum limit of your php.ini file. That is, if you want to set the above-mentioned “Maximum Upload Size” to be a much larger size than your php.ini, then you would alter the values from the php.ini file. To do that, just log onto your cPanel interface and then go to “Files” > “File Manager.” Once you’ve selected the directory to edit the php.ini file, you can press the upper-right “Code Editor” button to start making changes.

Increase Max Upload Size

To increase the upload files limit to 20 MB, you are required to add the following directives to a php.ini file. To be frank, changing the limit on uploaded files and posts can also be done within the .htaccess file.

upload_max_filesize = 20M
post_max_size = 20M

Pay attention that, only users who run PHP as a “CGI” module would have such a php.ini file. If you are unsure about any aspect of the PHP settings, you’d better contact the hosting provider.