i want to open a file with ms word

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blackjack2150
    New Member
    • Feb 2007
    • 79

    i want to open a file with ms word

    i want to open a file with ms word
    below it's the code . The problem is that when word open the file it doesn't save it with the extension .doc but with .php. It's strange because if i try to opent with ms-excel the extension of the saved file is .xls .
    <?php
    require_once('C onnections/baza.php');
    mysql_select_db ($database_baza , $baza);
    $query_Recordse t1 = "SELECT bindata FROM notiz where nr=1";
    $Recordset1 = mysql_query($qu ery_Recordset1, $baza) or die(mysql_error ());
    $row_Recordset1 = mysql_fetch_ass oc($Recordset1) ;
    $totalRows_Reco rdset1 = mysql_num_rows( $Recordset1);

    if($_GET['mesaj']=="download") {
    header("Content-Type: application/vnd.ms-word");
    echo $row_Recordset1['bindata'];
    exit();
    }
    ?>
  • TheMadMidget
    New Member
    • Oct 2006
    • 98

    #2
    Add this near the other header line and using $filename accordingly, note the single and double quotations if you're editing it.
    Code:
    header('Content-Disposition: attachment; filename="' . $filename . '.doc"' );

    Comment

    Working...