finished code to properly download file from database, database works now, still needs loads of security fixes and checks