| | |
Delete temporary file on users machine?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Quick question here. I wanted a way to quickly change the URL of an image that is place on my page, so I came up with the following little script:
I pass the $status variable from a link before this page.
It works the first time. Actually it works all the time, but after the first time, the old image is left in the users temp directory, so the image doesn't change until they delete it from their temporary internet files. In firefox, it works ok if you just refresh the page, but in IE, it doesn't work until you delete the temp files. is there another way i can go about this?
Let's assume that I can't change the code on the page that is calling the image. That's why I need to change the name of the file on the server.
Thanks.
php Syntax (Toggle Plain Text)
<?php echo "Status: $status"; if ($status == 'Online'){ rename('status.bmp', 'offline.bmp'); rename('online.bmp', 'status.bmp'); } elseif ($status == 'Offline'){ rename('status.bmp', 'online.bmp'); rename('offline.bmp', 'status.bmp'); } echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=status.htm\">"; ?>
I pass the $status variable from a link before this page.
It works the first time. Actually it works all the time, but after the first time, the old image is left in the users temp directory, so the image doesn't change until they delete it from their temporary internet files. In firefox, it works ok if you just refresh the page, but in IE, it doesn't work until you delete the temp files. is there another way i can go about this?
Let's assume that I can't change the code on the page that is calling the image. That's why I need to change the name of the file on the server.
Thanks.
Last edited by nathanpacker; Dec 3rd, 2007 at 6:30 pm.
php Syntax (Toggle Plain Text)
<?php header('Cache-Control: no-cache, no-store, must-revalidate'); //HTTP/1.1 header('Expires: Sun, 01 Jul 2005 00:00:00 GMT'); header('Pragma: no-cache'); //HTTP/1.0 ?>
Use the above code to tell the browser not to cache the page.
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
Well, I tried putting this in the <head> tags of the page:
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
As well as this:
<META http-equiv="Pragma" content="no-cache">
And it's still having the same problem.
Any ideas? Sorry, I guess this is now turning into an HTML discussion, of which I am even less experienced with than PHP, but that's another story!
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
As well as this:
<META http-equiv="Pragma" content="no-cache">
And it's still having the same problem.
Any ideas? Sorry, I guess this is now turning into an HTML discussion, of which I am even less experienced with than PHP, but that's another story!
hmm.. well, i am kinda lost too. But, If you can use javascript, try location.href="status.html". Some other alternatives (?). Try
<META HTTP-EQUIV="EXPIRES"
CONTENT="Mon, 22 Jul 2002 11:12:01 GMT"> or, you can redirect to another page, say, page1.html and then, redirect back to status.html.
If no-cache doesn't work, then i don't know what will ?
<META HTTP-EQUIV="EXPIRES"
CONTENT="Mon, 22 Jul 2002 11:12:01 GMT"> or, you can redirect to another page, say, page1.html and then, redirect back to status.html.
If no-cache doesn't work, then i don't know what will ?
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
- SpeedUp Your Window XP Never Than Before (Windows tips 'n' tweaks)
- Virtomonde and win32.trojan.agent help (Viruses, Spyware and other Nasties)
- "Cannot find server or DNS Error" and Trojan Virus (Viruses, Spyware and other Nasties)
- Help! - Hijack log but i need to know what to delete (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: email question
- Next Thread: Problem with $_GET and JOIN
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary body broken cakephp checkbox class cms code cron curl database date date/time directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail menu mlm mod_rewrite msqli_multi_query multiple mycodeisbad mysql oop parse paypal pdf php problem query radio random recursion regex remote script search send seo server sessions sms soap source space sql static structure syntax system table tutorial update upload url validation validator variable video web webdesign wordpress xml youtube






