|
Posted by tihu on 04/25/06 03:29
thehuby wrote:
> I am building a CMS and as part of it a user can upload an image.
>
> Once uploaded I am displaying the image.
>
> If the user then decides they want to replace the image with another I
> get a caching issue in the browser as the image has the same name.
>
> Without having to use unique file names each time the user replaces an
> image, how can I force the browser to check for the file properly?
>
> Thanks in advance,
>
> Rick
Hey there
Setting http headers for the images will do, like,
Cache-Control: no-cache
Pragma: no-cache
Expires:0
You can use the header() function if the images are sent though php
If the images are stored in a directory and delivered by apache then
add these to the .htaccess file in the images directory
Header set Cache-Control "no cache"
Header set expires "0"
Header set pragma "no cache"
If your images are sharing a directory with html and other files (that
you may want cached) then read
http://www.linuxdevcenter.com/pub/a/linux/2002/02/28/cachefriendly.html?page=2
for a flexible solution.
http://www.netapp.com/solutions/cache_basics.html was helpful too,
apparently the pragma header is often ignored but the other two headers
are reliable
No, thank you
Tim
Navigation:
[Reply to this message]
|