add directory parameter to createfilepath
save file data when saving track to database