Fix for issue #1129. Keep original file extension for upload file