Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-1721

Correct math for detecting allowed file size during upload

    XMLWordPrintable

    Details

    • Change Log Group:
      Fixed
    • Change Log Message:
      When maximal uploaded file size in "php.ini" was configured in KB or GB it was treated in MB.
    • Story Points:
      1
    • Copy Issue Key:
    • Patch Instructions:

      Patches must be submitted through Phabricator.

      Description

      1. create "kUtil::parseIniSize($size)" method, that will: - 0.5h
        • if value is integer, then return it as-as
        • if value contains K/M/G shorthand (case insensitive) then return numeric part multiplied by byte equivalent for a particular shorthand
      2. in "startup.php" use this logic for "MAX_UPLOAD_SIZE" constant value detection: - 0.5h
        1. start with "kUtil::parseIniSize" processed value of "upload_max_filesize" setting
        2. get value of "post_max_size" setting and when it's value isn't "0" (means we have restrictions), then:
          1. use "kUtil::parseIniSize" function on it
          2. choose smallest value between this one and previous one
        3. get value of "memory_limit" setting and when it's value isn't "-1" (means we have restrictions), then:
          1. use "kUtil::parseIniSize" function on it
          2. choose smallest value between this one and previous one
        4. set "MAX_UPLOAD_SIZE" to result above calculations

      Quote: 1h*1.4=1.5h

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
                Developer:
                Erik Snarski [Intechnic]
                Reviewer:
                Alex
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4.3h
                  4.3h