One of our clients wanted the ability to limit the size of the files which could be uploaded in the quiz questions.
I created a patch for this. Was a bit surprised that this functionality was not already in the module.

The default upload limit is set to 15MB.
Upload limit can be set on the admin config page: admin/quiz/settings/questions_settings
And can be overridden on the node edit page.

Comments

Johan den Hollander created an issue. See original summary.

johan den hollander’s picture

StatusFileSize
new5.65 KB
johan den hollander’s picture

Previous patch included something not related to the functionality in this issue.
(Allowed extension vs Allowed extensions).

I will create a new issue for this.

da_cloud’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 3: add_ability_to_limit_upload_filesize_2973014-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

da_cloud’s picture

Seems like a nice feature to add to the module. The patch itself looks fine as well, but 2 minor things come to mind.

1) The tests are currently failing because its missing the new database field during install. The changes made in the new hook_update are missing within quizfileupload_schema.

2) In terms of the default upload limit I would personally prefer to follow the same logic as the file upload module itself. It seems to work using a combination of file_upload_max_size() to determine a sensible default based on the server settings and parse_size() to allow the user to fill in various size indicators (instead of forcing on only MB).

da_cloud’s picture

Status: Needs work » Needs review
StatusFileSize
new7.77 KB

I've reworked the patch to be more inline with how the file module handles the max filesize.

Status: Needs review » Needs work

The last submitted patch, 7: quizfileupload-Add_ability_to_limit_upload_filesize-2973014-7.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

da_cloud’s picture

Status: Needs work » Needs review
StatusFileSize
new7.84 KB

Fixed some of the test cases.

  • Da_Cloud committed 94177db on 7.x-5.x
    Issue #2973014 by Johan den Hollander, Da_Cloud: Added ability to limit...
da_cloud’s picture

Status: Needs review » Fixed
johan den hollander’s picture

@Da_Cloud We tested the latest dev version, with this functionality included. It works as expected. Thank you for improving the initial patch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.