| | |
stop the caching
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
i have created a website where the user is able to upload images and then they are displayed on and email which is then sent out to the people of there choice.
the problem i am getting is that the images are being cached and then the new images are not displaying.
i have used if file exist to display the images on the email and also used it to unlink the files once they have been used. When the user comes to use the system next time if they upload an image of the same file type then it is displaying the cached version and not the new image. if a image with a different file type is uploaded then it works, but this will only show different images as long as the file type has not been used.
i have tried using this
which has had no effect on the situation. i put the above code inside the head tag is this the correct place to put it. the reason i put it there is because this is usually were the meta tags are placed.
the problem i am getting is that the images are being cached and then the new images are not displaying.
i have used if file exist to display the images on the email and also used it to unlink the files once they have been used. When the user comes to use the system next time if they upload an image of the same file type then it is displaying the cached version and not the new image. if a image with a different file type is uploaded then it works, but this will only show different images as long as the file type has not been used.
i have tried using this
PHP Syntax (Toggle Plain Text)
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
which has had no effect on the situation. i put the above code inside the head tag is this the correct place to put it. the reason i put it there is because this is usually were the meta tags are placed.
Yep ! <head> tag is the right place to put meta tags. I haven't come across caching problem, but maybe you can use this.
Source: http://nl2.php.net/header Ex. 2
php Syntax (Toggle Plain Text)
<?php header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past ?>
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
i have tried that and had no joy. i checked on the server to see if it was a problem with the unlink code i have but it is defiantly uploading the images and removing the old files on the server. I know this as the time stamps for when the file was uploaded are changing.
i will have a good search around the web and see what i can find i will post it here if i find anything that works.
i will have a good search around the web and see what i can find i will post it here if i find anything that works.
the images are being cached on the server i think and this why the same images show up on the emails i think. i am working on adding a random number to the image when it is uploaded and then using the post/get method to retrieve the value of the random number to use to display the image.
if a random number is added to the image then the image that is shown on the email page will always have a different value added to it so it should always show the new images that are uploaded.
well that is the theory behind it anyway weather it works or not is another thing.
if a random number is added to the image then the image that is shown on the email page will always have a different value added to it so it should always show the new images that are uploaded.
well that is the theory behind it anyway weather it works or not is another thing.
is it possible to a random number to a image file without it becoming a part of that file name. what i want to do is where i am displaying the image add a random number so that the image when cached has this number attached to it but it is not part of the path to the file.
so i want it to be displayed by getting the file name then adding the number so that the number changes every time the page is viewed and the image cannot be displayed from the cach
so i want it to be displayed by getting the file name then adding the number so that the number changes every time the page is viewed and the image cannot be displayed from the cach
i am storing the files on the server so that they can be recalled when the email is sent out with the images held within it. the reason i want to add the random number after they have been stored is because the images are being cached.
the problem with the images getting cached is if the user comes and uploads a new image with the same file extension it will only show the cached version of the image. i have tried to stop the images getting cached with various different methods which in clude php headers and html meta tags, both methods failed.
so my next attempt at trying to get it show the new images is by adding a random number. if i store the number with the file i have no way of knowing the full path to the file once a random number has been added to it.
i tried a method were the random number that was generated was sent to the other pages with the session_start() function but that through up a load of errors with my code that is working fine without that in.
if i can get it to find the image without the random number attached to it then add this i am hoping this will stop the old images from being displayed on the pages. I know it is a problem with the images being cached because each time the upload page is entered it unlinks the last file that was uploaded.
hope that makes it a bit more clear.
the problem with the images getting cached is if the user comes and uploads a new image with the same file extension it will only show the cached version of the image. i have tried to stop the images getting cached with various different methods which in clude php headers and html meta tags, both methods failed.
so my next attempt at trying to get it show the new images is by adding a random number. if i store the number with the file i have no way of knowing the full path to the file once a random number has been added to it.
i tried a method were the random number that was generated was sent to the other pages with the session_start() function but that through up a load of errors with my code that is working fine without that in.
if i can get it to find the image without the random number attached to it then add this i am hoping this will stop the old images from being displayed on the pages. I know it is a problem with the images being cached because each time the upload page is entered it unlinks the last file that was uploaded.
hope that makes it a bit more clear.
![]() |
Similar Threads
- BLUE Screen stop 0x8e (Windows NT / 2000 / XP)
- STOP Error 0x0000007A, KERNEL_STACK_INPAGE_ERROR (Troubleshooting Dead Machines)
- STOP: 0x0000000A ..... HELP PLEASE! (Troubleshooting Dead Machines)
- Hijack this log, can someone help me please?? (Viruses, Spyware and other Nasties)
- Windows will not start up properly? (Windows NT / 2000 / XP)
- Checking file on System C (Windows NT / 2000 / XP)
- boot problems (Windows NT / 2000 / XP)
Other Threads in the PHP Forum
- Previous Thread: How to pass array values from php to mysql stored procedures??
- Next Thread: Hopefully a straightforward PHP/MySQL question
| Thread Tools | Search this Thread |
301 apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html httppost if...loop image include insert ip javascript joomla jquery key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search searchbox server session sessions sms sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website youtube zend






