Saving and executing files that are in a table

Hello,
I am trying to save files such as Word docs, pdfs and .avi files in
a MySQL table and then run them. In the case of modifiable items such
as word processor files I would like to change them and resave them. In
the case of files such as short movies they would only be viewed. Using
the book “Agile Web D. with Rails” I have been able to load a
Word doc from a file location into a longblob in a table and put
descriptive data in other fields (p.362 ff).
I can’t figure out how to do the second part: make them available
for editing. I would think that they should be copied to a temp
location and then run from there, followed by resaving to the database,
but I can’t find the calls and code to do that in the book (the book
only shows how to copy a picture to a browser), or by scanning the APIs
at this site.
What am I missing? Thanks,
Barry