title: PHP: How to sanitize uploaded filenames?
body: <p>I have a PHP application.</p>
  
  <p>I allow users to upload files to my web application.</p>
  
  <p><strong>Question</strong>:  What's the best way for me to sanitize the file names of the uploaded documents <code>$_FILES["filename"]["tmp_name"]</code> in PHP?</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>Can I take an MD5 of the uploaded filename and use that as the newly assigned filename? If so, how do I do that in PHP?</p>