DELETE temp file from PHP from REQUEST PC ?

Discussion in 'PHP' started by KingCobra, May 29, 2009.

  1. #1
    I have a site (php-mysql) with some flash content. I need it regularly updated.

    But the problem is that, If I change any .swf (flash file) file and brouse the site the I, and my visitors see the old .swf file unless we clean our cokies or temp file. After doing that we can see new file.

    Is there any way to clean particular temp files or files related with my site from client (request) PC when they visits my site, so that they can see updated contents ?

    Is there any php or javascript code to doing this silently with my site?
     
    KingCobra, May 29, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    If you know the location of the file you can use unlink() to get rid of it. The script would need to have write permissions to do so, but as long as you can upload/transfer into a directory, you should be able to delete from it as well.

    http://www.php.net/function.unlink
     
    jestep, May 29, 2009 IP
  3. KingCobra

    KingCobra Well-Known Member

    Messages:
    289
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #3
    I nee dto clean client pc cokoies or temporary file
     
    KingCobra, May 29, 2009 IP
  4. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #4
    jestep, May 29, 2009 IP
  5. johnkramlich

    johnkramlich Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Once a browser caches content locally it will not be removed from the cache until after the expires date. One way around this is to add a parameter to the url of anything you want to force the end user to redownload.

    Example:
    mycontent.swf
    becomes
    mycontent.swf?v1

    Just update the version number in your HTML each time you need to push a new version of the file
     
    johnkramlich, May 31, 2009 IP
  6. KingCobra

    KingCobra Well-Known Member

    Messages:
    289
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #6
    johnkramlich,

    How can i do that?
     
    KingCobra, Jun 1, 2009 IP
  7. johnkramlich

    johnkramlich Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Your HTML code should look something like this (I have removed most of the attributes for brevity):

    <OBJECT id="myMovieName">
    <PARAM NAME=movie VALUE="myFlashMovie.swf">
    <EMBED href="http://www.mysite.com/flash/myFlashMovie.swf?version=1"></EMBED>
    </OBJECT>

    Each time you update your flash file you can append a version number to the end of the SWF URL. So, you would have URLs like:

    http://www.mysite.com/flash/myFlashMovie.swf?version=1
    http://www.mysite.com/flash/myFlashMovie.swf?version=2
    http://www.mysite.com/flash/myFlashMovie.swf?version=3

    The browser will treat these URLs as new files and redownload them.
     
    johnkramlich, Jun 1, 2009 IP
  8. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #8
    Or, you could try using Meta-tags - for instance EXPIRES or CONTENT-CONTROL NO CACHE - used together, these should prevent any caching of content on the webpage.
     
    PoPSiCLe, Jun 2, 2009 IP