473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Page needs to be refreshed twice for correct photo to appear

I have a folder called "events" for guest speakers. There is one file there called "guest_pic1.jpg".

Here is what happens:

1. I select a picture from my local disk
2. I hit "submit" and it uploads properly.
3. Picture displays properly when page is reloaded.
4. Now, I select a different picture from my local disk.
5. I hit "submit" and it uploads properly, overwriting the original picture.
6. I now reload the page but the original picture is there, not the new one.
7. However, if I refresh the buffer again, the new picture displays correctly.

Do you know why this is happening?
Jan 25 '08 #1
3 1545
brettl
41
Sounds like the image is being cached by the browser.


I have a folder called "events" for guest speakers. There is one file there called "guest_pic1.jpg".

Here is what happens:

1. I select a picture from my local disk
2. I hit "submit" and it uploads properly.
3. Picture displays properly when page is reloaded.
4. Now, I select a different picture from my local disk.
5. I hit "submit" and it uploads properly, overwriting the original picture.
6. I now reload the page but the original picture is there, not the new one.
7. However, if I refresh the buffer again, the new picture displays correctly.

Do you know why this is happening?
Jan 25 '08 #2
Try this...

Add this line to your form.

[HTML]<input type="hidden" name="i" value="<?=rand()?>">[/HTML]

now pass "i" into the url. The rand() will generate a random number every time the page is loaded. When it gets passed in the url, the browser will not cache the photo because it will think its a new page because the url keeps changing (thanks to the random int you keep passing).

Hope this helps
Jan 27 '08 #3
Markus
6,050 Expert 4TB
Try this...

Add this line to your form.

[HTML]<input type="hidden" name="i" value="<?=rand()?>">[/HTML]

now pass "i" into the url. The rand() will generate a random number every time the page is loaded. When it gets passed in the url, the browser will not cache the photo because it will think its a new page because the url keeps changing (thanks to the random int you keep passing).

Hope this helps
Incase that causes problems:

[HTML]<input type="hidden" name="i" value="<?php echo rand();?>">[/HTML]

:)
Jan 27 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Manny | last post by:
I have a web form "Page1.asp" and it reads data from a database, does some calculations, and displays the records in pages. Works fine. I have a button that displays on the page, defined as...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
179
by: SoloCDM | last post by:
How do I keep my entire web page at a fixed width? ********************************************************************* Signed, SoloCDM
3
by: Regnab | last post by:
I've made an access report which shows the number of people in 5 activities. As you can imagine, it only takes up about a quater of the page. I have to give a copy of this report to two people, and...
5
by: Bill Cohagan | last post by:
I'm constructing an ASP app with a frameset on the home html page. From frame A I need to referesh the page in frame B when a button click occurs on a button in Frame A (server side event handler)....
3
by: IGotYourDotNet | last post by:
Let me just start by saying taken over someones else code that they wrote just for them to understand(no comments, documentation NOTHING) is a task on in itself. anyway, i have a page that needs to...
0
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is...
5
by: Jeronimo Bertran | last post by:
I have a DataGrid that gets filled based on a filter which is defined by the values that the user selects on several controls. When the page postbacks after changing the selection on the filter...
2
by: Samy | last post by:
Hi There, I have a user control with buttons on it which I use on a aspx page (parent page). On a button click, a modal dialog(aspx page) opens up and the user enters some info in the modal dialog...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.