I am making a website for my local primary school, and I have each class page as a separate page template. Rather than have all their uploads go into the general /uploads/ folder I'd like to direct uploads to certain folders based on their page template, so that page-class1.php media uploads will always go to /uploads/class1/ and page-class2.php will go to uploads/class2/ (or some specific folder).
I can then control these uploads and sort them by size/date if one class is getting too many uploads I can ask them to limit/clear them. And setting this system in place may allow us to protect them differently depending on the class and content.
I would have thought this was a fairly common issue but I can't seem to find this question asked on this site (specific to page templates or even post-type). So, what is the method to direct uploads to different folders, based on the page template?