Friday, October 5, 2007

Uploading new file versions and commenting on them

I did some work on the Documents page, so that now users can upload new versions of files and leave comments on them. I was worried that I would have difficulty getting the file upload functionality to work. We are letting users upload any type of file, and I though that would be harder than the display picture upload, which is just images. In fact, the opposite was true. We don't need to check what the file type is and so its really easy to upload files.

We have always planned to rename uploaded files in the following format: {file_version_id}.{extension}. In our original database design, we intended to save this filename in the database. But I realised that by including the file version id we are creating redundant data by storing the primary key twice. So I decided to only store the file extension. We will work out file names on the fly when we need them, by joining the file version id with the extension.

No comments: