Security hole: check that the user can access the file before creating the file