title: Which characters should I escape/sanitize for file names?
body: <p>I need to sanitize some data which will be used in file names. Some of the data contains spaces and ampersand characters. Is there a function which will escape or sanitize data suitable for using in a file name (or path)? I couldn't find one in the 'Filesystem Function' section of the PHP manual.</p>
  
  <p>So, assuming I have to write my own function, which characters do I need to escape (or change)?</p>