The principle is very simple: store the file on disk, and store it's filename and location in the database.
SO if a user uploads a file called 'foo.txt' you would save it as '/userdata/foo.txt' and you would put '/userdata/foo.txt' into the database. Then you can still use the database's functionality to find all files that belong to user X, and when you really need the file itself you can access it directly throughthe filename.
The only snag is that you have to create some sort of storage manager that will create new subdirectories so that you don't end up with one directory with 10000 files in it.