While David's answer directly relates to the question as it's asked, there's more to consider when determining user intentions. You can't necessarily rely on just the file extension to know what the user wants to do. After all, the user could manually type .form
into the filename themselves, and then what should you do?
Instead, such options shouldn't be implemented on this level. In my experience, such things are implemented on an intermediate level. For example, think of video editing / production. The user may wish to render the video as an MP4
video. Or perhaps an AVI
. However, each of those possible formats has a wide variety of other specific options, such as video codecs, quality, and more.
What needs to be done in situations like this is to provide an additional layer of user options before saving a file. Let it be part of a "project" in a sense. User does what they need to do with their content, and part of the process is deciding what type of output format they intend to produce. When the user decides to save, before prompting them for the filename, first prompt them for other specific format options, depending on what formats your application supports.
Long story short, don't rely on the file extension itself to identify all of the user's intentions. There should be an intermediate level of user choice how the file should be formatted, before choosing the output extension.