Open Excel file from SQL Server table fieldtype varbinary (MAX) by an AJAX event

I have an application table where I have saved application (forms, grids and Excel-Files) by own application names. Excel is for the user also an application like a scriptcase form/grid. I show this “applications” in a grid, restricted by user access over groups rights. For all applications I have an application name “app_description” (not the scriptcase name). I open the scriptcase application by a AJAX Event (code is below) when a user clicks on the field “app_description”. I want also open a excel file stored in the same database table (dbo.dec_apps) by clicking on “app_description”. I don’t want to show the filename of the excel file to the user. He should allways open all applications whether it is a scriptcase form or an Excel table by clicking on “app_description”. I have stored the excel file in two fields (filename field type -> varchar(255) and fileDB field type -> varbinary(MAX). Is there any chance to open this excel file by an AJAX Event?

$sql = “SELECT app_name FROM dbo.sec_apps WHERE app_id = {app_id}” ; // “app_name” is the scriptcase form or grid name

sc_lookup(rs, $sql);

if(count({rs}) == 0)
{

//sc_error_message({lang_error_xxxx});
sc_error_exit();

}
else
{
$redir_app = ‘…/’ .{rs[0][0]};
sc_redir($redir_app);
}

Only if you store the fileDB contents to a file and you force a download, or if you directly force the output.
Some info is here:
http://stackoverflow.com/questions/7263923/how-to-force-file-download-with-php basically you send the header into and then the file data which you extract from your varbinary.