I was a common problem with the transparent proxies of my ISP (telefonica spain). When I downloaded a newer version of a assigment I always downloaded the cache version of the file until the cache expired.
I write this patch to avoid that:
In upload.php:
if ($newfile_name) {
preg_match('/^(.*)([^\.]+)$/U', $newfile_name, $_salida);
$newfile_name = $_salida[1] .date('YmdHi'). '.'. $_salida[2];
unset($_salida);
if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name
With that code the $new_name will maintain the file extension but it will be preceded by year, month, day, hour and minute (seconds are unnecessary I think).
When a student upload a new file, the file name will always be different that the old one and will avoid proxy cache to send old cached files.
Comments? Suggestions?
We can prepend directly the date to the file name easily with:
if ($newfile_name) {
$newfile_name = date('YmdHi') .'.'. $newfile_name;
if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name
But I prefeer to prepend the date to the file extension than the prepend to the file name.
Best regards.
if ($newfile_name) {
$newfile_name = date('YmdHi') .'.'. $newfile_name;
if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name
But I prefeer to prepend the date to the file extension than the prepend to the file name.
Best regards.
Rather than renaming the file itself, we could just put a random string in the call to file.php ...
The problem is that we can (need) that proxies cache save a copy of this files y they are not changed.
If we put a random number en every download then the proxy cache misses all downloads.
Apending date to upload files we can also know the version or date it was updated if we save the assigments in hard disk.
If we put a random number en every download then the proxy cache misses all downloads.
Apending date to upload files we can also know the version or date it was updated if we save the assigments in hard disk.