I have a problem after uploading file but the page still show the previous image. I have to refresh the page 2-3 times to make the page show the correct image (new image).
I tried to add these line to the top og the page:
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 08 Nov 2014 05:00:00 GMT");
I have also tried to change the date to the past. But still not work.
In the .htaccess i have also put :
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/x-icon "access plus 604800 seconds"
ExpiresByType image/jpeg "access plus 604800 seconds"
ExpiresByType image/png "access plus 604800 seconds"
ExpiresByType image/gif "access plus 604800 seconds"
ExpiresByType application/x-shockwave-flash "access plus 604800 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 604800 seconds"
ExpiresByType application/x-javascript "access plus 604800 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</IfModule>
Nothing help, the page still perform the same thing. I have to refresh the page 2-3 times every time i uploaded new image.
What should I do ?
UPDATE
Some PHP lines (I have lots more but to be easy to see i just post the important lines)
$photo=$_FILES['photoA']['tmp_name'];
$photo_name=$_FILES['photoA']['name'];
$photo_size=$_FILES['photoA']['size'];
$photo_type=$_FILES['photoA']['type'];
$uid=$_POST['uid'];
$ext = strtolower(end(explode('.', $photo_name)));
if ($ext == "jpg" or $ext == "jpeg" or $ext=="gif" or $ext=="png") {
$filename=$uid.".".$ext;
copy($photo,"myfolder/$filename");
}
}
///in my index.php (After fetch sql)
if ($row['user_img'] !="" ){
echo"<div id='userimg_cont' style='background-image: url(../myfolder/$row[user_img]);'>
}