Setting max file upload size in Drupal 8

When working with images, you may want to restrict them in ways that will help keep your site optimized. While you may limit them in physical size, you may also want to restrict them as far as maximum file size. This will force the node creators to optimize images if they exceed the limit even if they fit within any size restrictions you may have set..

How to set maximum file upload size in Drupal 8

  1. Log into your Drupal 8 admin interface.
  2. edu Drupal 8 common images select menu

    Using the top menu bar, Menu Tab.

  3. edu Drupal 8 common images select structure

    Now a second menu bar will appear. Click on the Structure tab to continue.

  4. edu Drupal 8 common images select content type

    From here, click on the Content Types option from the Structure page.

  5. edu Drupal 8 108 set size settings 1 select manage fields

    Now that you are on the Content Types page, find the content type you want to set the image settings for. In our example, we will work with the Article type. Look tot he dropdown ont he right side of the Article row and Click on Manage Fields.

  6. edu Drupal 8 108 set size settings 2 select edit

    You are now taken to the Manage Fields page. From here you see a list of the current fields for Article content types. Click on the Edit option from the dropdown to the right side of the Image field row.

  7. edu Drupal 8 108 set max upload filesize 4 set max filesize

    The Image Settings page appears, where you will need to find the Maximum Upload Size field. Here you can enter the maximum size you want any uploaded files to be. You may set the size by kb, MB, orFor our example, we are setting them at 2MB.

    Note:The maximum size entered here must first pass the settings in your php.ini file. This size setting is noted under the field itself. If you set a size here that is larger than the php.ini file setting, the file will be restricted by the php.ini setting. You may need to change your upload_max_filesize setting in your php.ini as well.
  8. Once you have entered your size restrictions for either one or both fields, click on the Save Settings button. Your new filesize settings will now be active.

Was this article helpful? Let us know!