title: Replacing dots in a filename
body: <p>How should I replace dots with underlines without losing the file extension?</p>
  
  <pre><code>$str = $_FILES['files']['name']; //file.name.word.jpg
  $ext = end(explode('.', $str));
  $filename = explode('.', $str);
  //output file_name_word.jpg
  </code></pre>
  
  <p>ps: it needs to be before upload.. if the user uploads a file with dots it must to be renamed and inserted on db</p>