This is the better way to do it: filesystems are meant to handle files, whereas databases are meant to handle (generally) smaller bits of data. Doing it this way will also keep the database smaller, meaning that it'll take less time to do various operations.