Web Analytics Made Easy -
StatCounter refresh issue - CodingForum

Announcement

Collapse
No announcement yet.

refresh issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • refresh issue

    Hi,

    i have a script which will allow me to upload files in a diretory on my server, my script will also list the files that are in this directory as hyperlinks so that they can be open, downloaded etc.

    The problem is that if i open a spreadsheet file for example, modifyed it, and re-uploaded the new modifyed file, and then go and open it again via the hyperlink it still shows the old one even though the new file is uploaded.

    if i refresh the directory on the server and then open the file, the correct file is opened.

    any ideass.

    thanks in advance.

  • #2
    This trick works on images; I reckon it'll work on other types of files too. Add a random query string to the link's href value. This makes the browser think it's a different file every time it's clicked on and it won't use cache.

    PHP Code:
    <a href="spreadsheet.xls?r=<?php echo rand(1,10000); ?>">link</a>

    Comment


    • #3
      i have my code like this:-

      echo "<a href='/uploads/$file'>$file</a><br/>";

      having a little trouble getting your to fit with mine.

      Comment


      • #4
        PHP Code:
        echo "<a href='/uploads/$file?r=".rand(1,10000)."'>$file</a><br/>"

        Comment

        Working...
        X