fix uploaded filename with dot(.) in orig filename

for example:
I upload an image, 
the *original filename* is "254.JPG.jpg.140F3_0S.235.jpg"
the *uploaded filename* is "254.JPG.jpg.140F3_0S_.235_.jpg"
the filename *most of us* really want is "254_JPG_jpg_140F3_0S_235.jpg" or "254.JPG.jpg_140F3_0S_235.jpg"

so, my suggestion is change the code to

   $filename .= '_' . $part;