Cannot upload large files above PHP.ini limits

Created on 5 June 2017, over 7 years ago
Updated 24 April 2023, over 1 year ago

Unable to upload large files above PHP limits. Chunking does not work.

Test environment
Drupal version 8.3.2
Plupload version 8.x-1.0-beta1 and 8.x-1.x-dev dated 2017-Mar-25 were tried
Plupload library version 2.3.1
Plupload file widget version 8.x-1.0, this patch β†’ was needed to make it work on Drupal 8.3.2

Content type setup

  1. Create a new content type say AAA
  2. Add a file field to AAA
  3. Set max upload size to 10 MB
  4. Add extension that should be allowed "txt, cvs, gz, zip, pdf, ppt"
  5. Under 'Manage form display' set the file widget to 'Plupload widget' instead of default 'File'

Test

  1. Add new content AAA
  2. Upload one file over 2 MB (i.e. above PHP's POST MAX_SIZE limit)
  3. The upload portion works, however the content save complains about file size limit
πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States toamit

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain budalokko Girona
  • πŸ‡¨πŸ‡¦Canada OMD

    I've tried this with 9.5.8 and without the patch and I can confirm I'm still hitting php limit of 10 MB of file uploads.

  • Status changed to Active over 1 year ago
  • πŸ‡ͺπŸ‡ΈSpain budalokko Girona

    Did you set `chunk_size` and `max_file_size` in your `#plupload_settings`? Something like this should work:

        $form['plupload'] = [
          '#type' => 'plupload',
          '#title' => 'Plupload',
          '#upload_validators' => [
            'file_validate_extensions' => ['zip'],
          ],
          '#plupload_settings' => [
            'chunk_size' => Bytes::toNumber(ini_get('upload_max_filesize')) * 0.9 . 'b',
            'max_file_size' => '1GB',
          ],
        ];

    Those are necessary to upload files beyond `upload_max_filesize` PHP setting.

  • πŸ‡¨πŸ‡¦Canada OMD

    I'm using the Plupload File Widget with the Plupload Integration Module. Neither module seem to have any configuration. I'm not familiar with #plupload_settings. Can you tell me where to find those?

  • πŸ‡ͺπŸ‡ΈSpain budalokko Girona

    If you are using Plupload File Widget and the issue appears on a field you added to an entity then there's no need to mess with #plupload_settings.

    It should work without code, at least it does for me :)

    I'll try again to reproduce this week, can you please ensure through the UI "Maximum upload size" is empty or big enough in the field configuration, and send your setup: PHP version, upload_max_filesize and post_max_size from /admin/reports/status/php, both modules version and Plupload library version?

  • πŸ‡¨πŸ‡¦Canada OMD

    I'm uploading a 500 MB files as a test. I have my max upload size set at the field config level at 1000 MB, it looks like fails at 10 MB which is the PHP limit, the exact size is not given, but it fails quite early in the progress bar. Also it fails quietly and doesn't generate an error message. It also reminds me of the 10 MB limit below the field in both the field configuration form and the add content form, even if plupload file widget is chosen on the form.

    PHP 8.1.17

    upload_max_filesize 30 MB
    post_max_size 10 MB

Production build 0.71.5 2024