Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP Question

Options
  • 19-01-2007 11:20am
    #1
    Closed Accounts Posts: 73 ✭✭


    Im trying a content management sys using PHP. I seem to be having problems downloading the files in internet explorer they are being printed out as gibberish on a page, rather than using the correct appliaction.
    CODE
    $sql = "SELECT bin_data, filetype, filename, filesize FROM tbl_Files WHERE id_files=$id_files";

    $result = @mysql_query($sql, $db);
    $data = @mysql_result($result, 0, "bin_data");
    $name = @mysql_result($result, 0, "filename");
    $size = @mysql_result($result, 0, "filesize");
    $type = @mysql_result($result, 0, "filetype");

    header("Content-type: $type");
    header("Content-length: $size");
    header("Content-Disposition: attachment; filename=$name");
    header("Content-Description: PHP Generated Data");
    echo $data;

    Internet eplorer seems to ignore header("Content-type: $type");. Is there a way to store the file extension when uploading. And then use that file extension opening a file.


Comments

  • Registered Users Posts: 32,136 ✭✭✭✭is_that_so


    Have a look at PHP Net. There are some examples there on IE and headers.


Advertisement