I built a simple script in PHP which has two functions:
- Give uploaded file a UUID and timestamp, store it on disk using UUID as filename, return UUID.
- Retrieve and return stored file by UUID.
I built this without a database since the requirements were very simple, and due to policies of the client/hoster setting up a MySQL database would be tedious.
Now another requirement has come up. I need to add a function that returns a list of the X latest uploaded files, and if possible add pagination to it as well.
What’s the easiest way to do this without MySQL? Or is it sufficiently difficult to warrant getting a database set up?
If it’s as simple as that you can still use files. You can save timestamps in plain text file and retrieve last n rows from it. If you need something bit more complex you can try sqlite or Kyoto cabinet. Until you have a need to express relations between some sets of data, you can probably do without relational database.