Tag Archives: Website Performance with cPanel Upload Limits

How To Restrict File Upload Size On Your Website Using cPanel?

cPanel provides a straightforward way to restrict image upload sizes to control file storage and enhance website performance through the PHP.ini Manager, which allows you to adjust the upload file size limits.

If you’re managing a WordPress site, you can do same with the help of plugin as we have discussed in this lesson.

Here’s a step-by-step guide to setting upload size restrictions using the PHP.ini Manager in cPanel.

Step 1: Log In to cPanel

Access your website’s cPanel.

Step 2: Access The PHP.ini Manager

In the Software section, look for MultiPHP INI Editor. This is where you can modify PHP settings for different domains.

Click on MultiPHP INI Editor to open the configuration tool.

    Step 3: Select The Domain

    Choose the domain you want to configure from the dropdown menu. If you want these settings to apply to all sites on the server, you may need to select the root directory or the specific domain directory.

      Step 4: Adjust The Upload Size Limits

      In the PHP configuration editor, locate the following settings to control the file upload size:

      • upload_max_filesize: This setting defines the maximum size of each file that can be uploaded. Set it to the desired limit for image uploads (e.g., 2M for 2 megabytes).
      • post_max_size: This controls the maximum size for all POST data. Make sure it’s equal to or larger than upload_max_filesize to avoid upload issues.
      • max_execution_time: This optional setting adjusts the time allowed for uploads. You may increase it slightly if users face issues with large files timing out.

      Simply update these values:

      • upload_max_filesize = 2M
      • post_max_size = 2M
      • max_execution_time = 300

      After values are updated, Save it to confirm the changes.

        Step 5: Test The New Settings
        1. Go to your website and try uploading an image file that exceeds the new limit to ensure the restriction is working.
        2. If the upload fails with a size-related error, the configuration is correctly set.
        Other Tips For Optimizing Image Upload Sizes
        • Compress Images Before Uploading: Encourage users to compress images for faster site performance.
        • Use Image Optimization Plugins: For WordPress, plugins like Smush or Imagify can further optimize image sizes automatically.

        By using the PHP.ini Manager in cPanel to restrict image upload sizes is a practical way to control file sizes and improve your site’s efficiency. By following these steps, you can ensure your site remains fast and responsive even with multiple image uploads.