$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");

So what is your question?

Be a part of the DaniWeb community

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