Storing files in a MySQL database has a number of uses. You can make the files searchable, allow your users to add files, control and count file downloads, or display random files. This also gives you the option to literally house your entire website in the MySQL database.
Allowing users to upload files is accomplished through a simple web form. The form is then processed by PHP which adds the necessary slashes and uploads it as a BLOB to the MySQL database.
Allowing users to upload files is accomplished through a simple web form. The form is then processed by PHP which adds the necessary slashes and uploads it as a BLOB to the MySQL database.

I tried creating a generalized version for storing files into mysql, and retrieving it with streaming support. The whole solution with the php class is put up for download.
Read about it at my post MySQL FileSystem – A PHP Implementaion