Updated code to check that file to be uploaded is text/plain before processing