I am working on a project, where the client needs to be able to restrict files that are uploaded based on who is logged in.
Basically, some users have a “quota” (total allowed upload size). If the user tries to upload a file (or files) that exceed this limit, then the files are rejected and an error is sent to the user.
Currently I am thinking of doing this by:
Creating a new version of
UploadField::upload()(which will flag an error if the upload is too large).
File::onBeforeWrite()to flag an error (or raise an exception) somehow.
I was wondering if anyone had any pointers? Are the points above the best approach? I am not 100% about if point 2 will work…