Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP: Force download header wont show total size and speed
    primarykey
    data
    text
    <p>Whenever I use this script to download a file, I can't see the total size and the speed while downloading... I want to to make it look more like the 'direct download link'. The purpose of this script is to hide the direct download link restrict direct downloading and other download behavior, like bots. Think of mediafire, rapidshare, megaupload etc. </p> <p>The script we have now works but is not displayed as how it is displayed when you download from a normal download link, I will post a screenshot of what's happening:<br> <img src="https://i.stack.imgur.com/QTMvg.jpg" alt="enter image description here"></p> <p>I hope this screenshot helps, because I've searched the internet for hours and can't seem to find a solution to this :(.</p> <pre><code>if (isset($_GET['file'])){ $file = $_GET['file']; $path = '/home/user/domains/domain.com/files/upload/'; $filepath = $path.$file; if (file_exists($filepath)){ set_time_limit(0); // for slow connections header('Content-Description: File Transfer'); header("Content-Disposition: attachment; filename=\"$file\""); header('Content-Type: application/octet-stream'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($filepath)); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Expires: 0'); readfile($filepath); // send file to client } else{ header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404); } }else{ header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload