Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

PHP Question

  • 19-01-2007 10: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, Registered Users 2 Posts: 32,132 ✭✭✭✭is_that_so


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


Advertisement