adding random number

Thread Solved

Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

adding random number

 
0
  #1
May 12th, 2008
i am using php to upload images onto the server and then they are being displayed on other pages around the site. the problem i am having is if the user changes the images that they have uploaded the old ones are displaying from the cache.

i would like to know if it is possible to get the image from the server and then add a random number to it so that the cached images will always have a different number appended to the end of the file when of the image when displayed.

i dont want the random number stored with the file i only want it to be used when the file is being displayed.

i have tried to store the image with the random number and then post the variable holding this number to other pages from the image upload form but this has not worked. the variable is not getting posted so i can only get the rest of the file name when i look at the image properties.
Last edited by kevin wood; May 12th, 2008 at 10:59 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 50
Reputation: ultra vires is an unknown quantity at this point 
Solved Threads: 5
ultra vires ultra vires is offline Offline
Junior Poster in Training

Re: adding random number

 
0
  #2
May 13th, 2008
i guess this is what you are looking for
http://www.webmasterworld.com/php/3146706.htm
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: adding random number

 
0
  #3
May 13th, 2008
that is sort of what i have working now but the problem with this method is that i am storing my images on the server and for me to be able to display the image again i must know what the appended number will be for me to be able to display the image again.

if it was possible to store the image like myimage.gif and when it came to display the image then have it as myimage.gif.1234 so that when the image was cached i it should be cahced with the number attached to it.

the more i think about it and the more i research it the more i am starting to thing that this will not work.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: adding random number

 
0
  #4
May 13th, 2008
i am storing the number in a mysql db and then getting the number out of the db and appending it to the image on the different pages the images are used.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC