|
<< Click to Display Table of Contents >> Navigation: Telegram > 2024 > 02 > 12 > Telegram_2024-02-12T17 |
2024-02-12T17:22:11
i wanted to share this idea :
i have some js and css files, which i always make changes to them.
every time i upload the new files to server i have to change the file names in order to be reloaded at browser, since old files have been cashed by browser.
so i made this small code at ServerController create event :
==================================
JavaFiles := System.IOUtils.TDirectory.GetFiles(gExePath + 'wwwroot\\JSX\\');
for JSFileName in JavaFiles do begin
fExt := SysUtils.ExtractFileExt(JSFileName);
ss := 'JSX\\' + ExtractFileName(JSFileName) + '?' + SysUtils.FileAge(JSFileName).ToString + fExt;
ContentFiles.Add(ss);
end;
==================================
this will add the modify date of each file after its name to get a new unique name