Solution 1:

They're of course both grammatical, but there is a conventional meaning difference that may not be obvious, as there often is with a verb like try that takes both Equi infinitive and Equi gerund complements. Such available syntactic bandwidth is likely to get used for pragmatic purposes.

In this case, the gerund is the one without any special entailments — i.e, saying

1. He tried opening the door.

requires no special assumption by a listener — or at least is intended to sound that way — while in

2. He tried to open the door.

the infinitive complement (but not the gerund) is subject to the Gricean interpretation (i.e, an interpretation, predictable from Grice's Maxims), that, if one can only say truthfully
"He tried to open it" instead of just "He opened it", then one conversationally implicates
his failure in opening it.

So, in context, (1) above can continue with any of the following:

  • but it failed to open.
  • and it creaked loudly as it swung open.
  • and found that there was a body in the dining room.
  • and the door fell off.

but only the first one is appropriate as a continuation for (2).

Solution 2:

Strictly speaking, "try doing something" usually implies you should try doing it as it's expected to solve a certain problem. On the other hand, "try to do something" usually implies a sole challenge, not necessarily with any practical result.

For example:

A) To imply an expected solution to a problem:

Person A: It takes me too long to fall asleep. What should I do?
Person B: Try watching a movie before going to bed.

B) To imply a challenge:

Person A: I'm not afraid of you!
Person B: Well, try to hit me in the face and see what happens!

So, to directly answer your question, this is how your examples explain themselves:

Try to save the file: Try to do it and let's see if you're successful!
Try saving the file: Try doing it and let's see if it solves the problem at hand!