Mobile app version of vmapp.org
Login or Join
Pope3001725

: Append a query string, usually a timestamp, to the end of the filename each time you change it. This will cause the URL to be different and force the browser to fetch a copy of the fresh

@Pope3001725

Append a query string, usually a timestamp, to the end of the filename each time you change it. This will cause the URL to be different and force the browser to fetch a copy of the fresh file.

Example:
app.ourwebsite.com/downloads/installer.zip?17245123784

That query string won't affect the file or the download. It will just force the file to be fresh each time it is changed.

OR

Serve the file through a script that sends no cache headers and then forces the download.

Example:
app.ourwebsite.com/downloads/download.php?file=installer.zip
<?php
$file = '/path/to/file/outside/www/installer.php';

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
header('Content-Transfer-Encoding: binary');
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
exit;
?>

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Pope3001725

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme