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

Incorrect checking of upload server limit in WebService upload.php script

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.1, 2.2
    • 2.2
    • Web Services

    Description

      If you set Administration > Security -> Site policies -> Maximum uploaded file size to sever limit the $CFG>maxbytes setting will be set to 0, this will prevent any file to be uploaded

      Check:

      https://github.com/moodle/moodle/blob/master/webservice/upload.php#L111

      if (($_FILES[$fieldname]['size'] > $CFG->maxbytes)) {

      This will always return true, so you can't upload files

      I think this will fix the problem:

      if ($CFG->maxbytes && ($_FILES[$fieldname]['size'] > $CFG->maxbytes)) {

      Attachments

        Issue Links

          Activity

            People

              jerome Jérôme Mouneyrac
              jleyva Juan Leyva
              Aparup Banerjee Aparup Banerjee
              Rossiani Wijaya Rossiani Wijaya
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                5/Dec/11