Re: Refresh of photo upload page in Browser too quick
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Wed, 19 Aug 2009 23:47:52 -0400
Frank Steinmetzger wrote:
Jerry Stuckle schrob:
Frank Steinmetzger wrote:Hi group,This is a browser caching issue, nothing to do with PHP.
[...]
The same thing happens when I click on the "Delete photo" button, also
handled by this same script, which does noting more than two unlinks.
Thumbnail is shown -> I click on delete -> page refreshes, but thumbnail
is still there -> refresh -> image is gone.
I'm already using
<meta http-equiv="expires" content="0">
in the HTML head, and I also tried sleep(1), in case the creation of the
thumbnail takes some time, while the page was already delivered. (OTOH,
deleting would happen instantly, so this is apparently not the issue).
Actually, it is PHP's fault, or to be precise, it's mine (of course).
I've changed the mechanics of the page by changing from file_exists() to
filesize() and, during that, rearranged the code a little. I found out that
after clicking on [delete image], the page still referenced the thumbnail
image, which was no longer there. It turned out that I moved the code to
detect the image's presence above the part where $_POST and the upload
itself is handled. -_-
Note to self: don't write code after 2 AM. Sorry to bother you.
Actually, that doesn't make a lot of sense unless you're deleting the image in the file which serves the image (which would be highly unusual, but possible). Images are served separately from the main html file, based on the <img ...> tag.
Rather, I suspect you're building the <img ...> code based on the (now deleted) old file and placing the old filename in it (or even the current one, if it has just been replaced). And instead of fetching the image, the browser is looking in its cache and just using that image.
Then, after a refresh, your code generates a new <img ...> tag with the new filename, so the browser gets the updated image (or, in the case of a deleted image, the code generates no <img ...> tag).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- Re: Refresh of photo upload page in Browser too quick
- From: Frank Steinmetzger
- Re: Refresh of photo upload page in Browser too quick
- References:
- Refresh of photo upload page in Browser too quick
- From: Frank Steinmetzger
- Re: Refresh of photo upload page in Browser too quick
- From: Jerry Stuckle
- Re: Refresh of photo upload page in Browser too quick
- From: Frank Steinmetzger
- Refresh of photo upload page in Browser too quick
- Prev by Date: Re: phpBB forum - green layout
- Next by Date: Re: eval(base64_decode(...) header -why?
- Previous by thread: Re: Refresh of photo upload page in Browser too quick
- Next by thread: Re: Refresh of photo upload page in Browser too quick
- Index(es):