you could also use `tmpfile` and let php do the job of cleaning the file up.