When you upload an attachment the system automatically examines the file to see what content type it is and uses this in preference to any information that was sent by the browser. If it was the wrong type - for example a GIF that was actually a JPEG - then the extension will be changed to match what the file really is.
1.0.0
Jiglu's automatic file sniffing to correct attachment content types and extensions.