fixed the back end so files are actually added to the database