Reading and writing file on the server, issues encountered trying to fix