It seems to me that Celada's reply fully answers your question: the only difference here is that now you want pass the name of the file to download as a parameter, whereas he hardcoded it. You only have to modify his code accordingly, obviously adding the necessary checks as needed.
Since you're using user input to return something from your local file system, I recommend you read some relevant document related to security issues. You may check the Tutorials section or Ovid's course.
In reply to Re^3: Showing Word document in browser
by blazar
in thread Showing Word document in browser
by Ernst
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |