Page 1 of 1

Problems with images not updating on upload

Posted: Thu Mar 25, 2004 12:48 pm
by mjseaden
Dear All

I've just more or less finished making a database 'add' feature on my site which allows the user to add text information about their item, and further upload 4 photographs of that item.

I follow the usual procedure for uploading the pictures, first using the FILE - submit routine for uploading the photographs to a temporary location, then use move_upload_file to move the file to a more permanent position on the server. The photographs are then displayed on an item information preview page.

However, I have noticed that whilst the first time I got the code to work, the photographs showed up as expected, I now notice that if I add another item and different photographs, the preview page shows the old photographs. It is not until I deliberately hit the 'refresh' button that the photographs update with the new ones, despite the fact that they are on the server and <IMG SRC="... is pointing to them correctly (otherwise they wouldn't show up when I hit 'refresh').

Is there anything I can do about this, otherwise my preview feature is redundant?

Many thanks

Mark

Posted: Thu Mar 25, 2004 1:41 pm
by mjseaden
Just to clarify, by 'old photographs' I mean the photographs that of a previous item I tried to add.

Posted: Thu Mar 25, 2004 1:43 pm
by markl999
It's probably just the browser caching them as i'm guessing all the preview images have the same name?
Either way, you could try giving each preview image a unique name (maybe use time() or uniqid()) or try using a no-cache header.
http://php.net/header has some cache header examples