$select     = "SELECT * FROM `success-stories` where id='$id'";
    $result     = $conn->query($select);
    $row        = $result->fetch_assoc();
    $file       = $row["download_pdf"];
    $file_arr   = explode("/", $file);
    $path       = $file_arr[0] . "/" . $file_arr[1] . "/" . $file_arr[2];
    header('Content-Description: File Transfer');
    header('Content-Type: application/pdf');
    header('Content-Disposition: attachment; filename="' . basename($file) . '"');
    header('Expires: 0');
    header('Pragma: no-cache');
    header('Content-Length: ' . filesize($file));

    $file1 = $path;
    flush(); // this doesn't really matter.
    $fp = fopen($file1, "r");
    while (!feof($fp)) {
        echo fread($fp, 65536);
        flush(); // this is essential for large downloads

    }
    fclose($fp);
    header("location:download-form.php?msg=story downloaded");
Re: download file and redirect to page in 80 80

So what is your question?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.