User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 363,386 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,841 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 356 | Replies: 3 | Solved
Reply
Join Date: Feb 2008
Posts: 262
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

adding random number

  #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 9:59 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 47
Reputation: ultra vires is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 5
ultra vires ultra vires is offline Offline
Light Poster

Re: adding random number

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

Re: adding random number

  #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  
Join Date: Feb 2008
Posts: 262
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: adding random number

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 12:27 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC