I have a image upload script, which replaces one picture by another, there is always the same amount of images, now everything works fine but
When I upload a picture (and the page refresges), it shows the last picture (which doesn't exists anymore) and not the current one, by checking the HDD I know it is uploading/updating it, but it is not showing properly on the PHP.
I have tried with:
Like you can see, I use rand() to create various names for all variables, to try the browser from caching it in.
Also, once someone uploads a picture, a blank page with a Continue link comes up, he clicks on that and is redirected to the page where is shows the picture which is then refreshed by javascript.
But nothing of those methods work, what I am doing wrong?
thanks in advance
When I upload a picture (and the page refresges), it shows the last picture (which doesn't exists anymore) and not the current one, by checking the HDD I know it is uploading/updating it, but it is not showing properly on the PHP.
I have tried with:
PHP Code:
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate, pre-check=0, post-check=0'" );
header( "Pragma: no-cache" );
PHP Code:
if ($_GET['refresh'])
{
echo '<body onload=`location.replace("' . str_replace('&refresh=1', '', $_SERVER['REQUEST_URI']) . '");`>';
}
else
{
echo '<body>';
}
PHP Code:
echo '<a href="' . $_SERVER['PHP_SELF'] . ?'blah-blah=blah&refresh=1">Continue</a>';
PHP Code:
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" enctype="multipart/form-data" name="' . rand() . '">';
PHP Code:
echo '<img src="' . $pic_loc[$i] . '" border="0" name="' . rand(). '" id="' . rand(). '">';
Like you can see, I use rand() to create various names for all variables, to try the browser from caching it in.
Also, once someone uploads a picture, a blank page with a Continue link comes up, he clicks on that and is redirected to the page where is shows the picture which is then refreshed by javascript.
But nothing of those methods work, what I am doing wrong?
thanks in advance
Comment