Aug 04 2008
Moodle 1.9: Cached File Downloads
This isn’t so much a bug as an undocumented feature that we don’t really want.
If you upload a file to Moodle (for example, a Word document) as a file resource, download that file, make a change to it, re-upload it, and then re-download it … you won’t get the changed file you were expecting, because the original download’s been saved to your web browser’s cache.
Web browsers like to keep copies of all the files they download in a cache. The idea is that this speeds up your surfing experience — why download something again when you just downloaded it a minute ago? So what’s happening is that your web browser is snagging the file and making a secretive copy of it deep with in its cache (a copy separate from the one you saved to your desktop or downloads folder). When you upload a changed file and then try and re-download it, the web browser looks at the copy it secreted away instead of the one that’s one the server.
Fortunately Moodle has a way around this, by setting the $CFG->filelifetime variable in config.php to 1 second. This causes the file’s “life time” to become exceedingly short, thus forcing your web browser to go and get a new copy instead of the original.
I’ve found that Firefox is better about listening to such “don’t cache this file” orders than Internet Explorer is, so if you continue to see this behavior in IE, try using Firefox instead.
Create a free edublog to get your own comment avatar (and more!)