Sumbit the form with your $file variable to the php script, check for validty of the submitted data, then something like the following should do the trick:
header("Location: /path/to/file/$file");
From a quick test -> if a non-binary file(plain text) is specified the browser will display the contents of the file in the browser window, whereas if the file in question is binary (tarball, executable, etc.) in nature the user will be presented with the standard download/open file dialog box (in IE 5.0 anyway). Hope this helps