Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-44626

Drag n drop upload do not show correct warning message when the size of the file is to big

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Decrease your php's post_max_size to something fairly small (56K?)
      2. Decrease your php's upload_max_filesize to something fairly small (128K?)
      3. Find a testfile (testfile1) which is larger than 56K and smaller than 128K
      4. Find a testfile (testfile2) which is large than 128K
      1. Navigate to a course and turn editing on
      2. Attempt to dndupload testfile1
        1. Confirm that you were told that the file was too large
      3. Attempt to dndupload testfile2
        1. Confirm that you were told that the file was too large
      4. Navigate to your private files
      5. Attempt to dndupload testfile1
        1. Confirm that you were told that the file was too large
      6. Attempt to dndupload testfile2
        1. Confirm that you were told that the file was too large
      7. Swap the post_max_size and upload_max_filesize and repeat.
      Show
      Decrease your php's post_max_size to something fairly small (56K?) Decrease your php's upload_max_filesize to something fairly small (128K?) Find a testfile (testfile1) which is larger than 56K and smaller than 128K Find a testfile (testfile2) which is large than 128K Navigate to a course and turn editing on Attempt to dndupload testfile1 Confirm that you were told that the file was too large Attempt to dndupload testfile2 Confirm that you were told that the file was too large Navigate to your private files Attempt to dndupload testfile1 Confirm that you were told that the file was too large Attempt to dndupload testfile2 Confirm that you were told that the file was too large Swap the post_max_size and upload_max_filesize and repeat.
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-44626-master

      Description

      To reproduce:

      • As admin go to the gradebook import of a course.
      • Try to drag n drop a file in the filepicker of any of the import format.

      If the size is to big (Bigger than the post_max_size directive in php.ini), The warning message displayed is: "A required parameter (sesskey) was missing".

      You can also reproduce it when adding a file resource.

      It turns out that there are two issues here:

      1. The file manager does not get passed the true maxbytes value for those with a particular capability. In this case, the value `-1` (meaning unlimited) is passed. As a result, the file-size check is unable to compare the size of file being uploaded to the max size and reject files; and
      2. when those files are then passed to the upload script, php cuts off all parameters because they are large than the post_max_size directive. Because the sesskey check comes before any check for presence of a file, a message about incorrect sesskey is instead shown.

        Attachments

        1. MDLUM-44626.png
          22 kB
          Gilles-Philippe Leblanc

          Issue Links

            Activity

              People

              Assignee:
              dobedobedoh Andrew Nicols
              Reporter:
              leblangi Gilles-Philippe Leblanc
              Peer reviewer:
              Simey Lameze
              Integrator:
              Dan Poltawski
              Tester:
              Ryan Wyllie
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Mar/16