2

I've FTPed a new installer file (for an app I'm maintaining) up to a server on the web, replacing the old installer file.

My boss has already sent an email to our users saying "get the new installer from this URL on Monday". The URL looks like "http://app.ourwebsite.com/downloads/installer.zip". I'm afraid I can't give you the real URL because there's some sensitive information up there. When I visit the URL though, I get the old installer. This happens in any of my browsers (FF, IE, Chrome), regardless of whether I clear the browser cache, used the browser before to download the file, close and re-open the browser.

If I change the capitalisation of any letter of the file-name part of the URL, I get the new installer.

What's going on here? And more importantly, how do I fix it so that when people visit the URL my boss sent out (in its original capitalisation), they get the right file?

2

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:

http://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:

http://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;
?>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy