Is it possible to store files like .swf, .wmv, .jpg, etc to a database? If so, then how would you do it?
Yes, you can store just about any file-type if you use a blob data type column. You can also base64 encode the data in the file and store it in a text field.
it i possible, but it is not recommended, because your database will grow and it will slow the server a lot. Instead it is recommended to store into the database just the name and location of the files.
In PostgreSQL you have an non SQL standard Bytea(rray) datatype which has the advantage of automatic LZ compression on the data when it meets certain criteria.
I agree that you should store only the name and full qualified path to the files versus a blob. I recently completed a project where the architect made the decision to store all documents as blobs in the database. Well, I cannot begin to enumerate all of the issues. A couple of the issues were managing the huge backups and not having the ability to view the blob contents. There was no way to view the blobs outside of the application. We had to write a custom utility to search and view the blobs in the database.