A class that contains code to handle file data fetching requests related requests.

This assumes that access control is needed for the files - if it isn't then the files should be stored in a sub-directory of the assets directory (or directories) in the root of the site and the web server will deal with things like range requests etc.

As written it assumes that there is a directory in the root of the site whose name is set in the constant DATADIR. It also assumes that there are subdirectories in DATADIR that provide the structure /user_id/year/month/filename

This code provides a very simple access control scheme whereby there is an upload database table that relates a filename with a user so that you can check that only the owner (or the admin) can access the file. The table should also contain the original filename that the user used when uploading the file, as this is returned as part of Content-Disposition. Allowing sharing with specified other users, groups of users or users with particular roles would not be hard to add.


Lindsay Marshall


2012-2020 Newcastle University



Interfaces, Classes and Traits

The Getfile class

Search results